返回顶部

收藏

放大一个uiimageview

更多
#define CONST_animation_time 0.5
#define CONST_enlarge_proportion 15.0

CGPoint UpPointOfView(UIView *view)
{
 return (CGPoint){view.center.x, 200+2+55/2};
};

- (void) circleAnimate:(UIImageView*)view
{
 CGContextRef context = UIGraphicsGetCurrentContext();
 [UIView beginAnimations:nil context:context];
 [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
 [UIView setAnimationDuration:CONST_animation_time];
 [view setCenter:UpPointOfView(view)];

 CABasicAnimation *scalingAnimation = (CABasicAnimation *)[view.layer animationForKey:@"scaling"];

 if (!scalingAnimation)
 {
  scalingAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
  scalingAnimation.repeatCount=1;
  scalingAnimation.duration=CONST_animation_time;
  scalingAnimation.autoreverses=NO;
  scalingAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
  scalingAnimation.fromValue=[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)];
  scalingAnimation.toValue=[NSValue valueWithCATransform3D:CATransform3DMakeScale(CONST_enlarge_proportion, CONST_enlarge_proportion, 1.0)];
 }

 [view.layer addAnimation:scalingAnimation forKey:@"scaling"];
 view.layer.transform = CATransform3DMakeScale(CONST_enlarge_proportion, CONST_enlarge_proportion, 1.0);
 [UIView commitAnimations];
}
//该片段来自于http://outofmemory.cn

标签:objective-c,控件

收藏

0人收藏

支持

0

反对

0

相关聚客文章
  1. admin 发表 2013-08-23 20:44:43 写了一个日历控件
  2. admin 发表 2014-02-11 07:31:54 谷歌分析iOS开发包实战
  3. Volcano 发表 2012-03-08 12:51:02 iPhone中png图片格式处理
  4. 博主 发表 2014-02-18 11:12:15 Associated Objects
  5. 博主 发表 2014-12-03 00:00:00 COSLayout: An iOS Layout Library
  6. redsun 发表 2014-03-10 15:03:04 Effective OC 笔记5
  7. 博主 发表 2013-11-11 14:19:00 自定义SegementedControl控件分析
  8. Parker Liu 发表 2015-05-18 06:15:22 Add Inner Shadow in UITextField(Any View)
  9. 庞海礁 发表 2014-11-28 08:57:21 iOS开发中如何更快的实现汉字转拼音
  10. Parker Liu 发表 2015-06-16 06:48:56 Why Cannot Connect HTTP on iOS 9?
  11. baiyunpeng 发表 2015-10-02 17:57:55 使用Swift语言自定义Pull To Refresh控件
  12. 博主 发表 2014-12-05 00:00:00 Android注解式绑定控件,没你想象的那么难 - 张涛