标签:
能通过UIViewAnimation执行的动画属性有:frame , bounds , center, transform , alpha , backgroundColor, contentStretch
(2.1) UIViewAnimation 操作UIview frame 属性:
#import "AnimationViewController.h" @interface AnimationViewController () @property (nonatomic, strong) UIButton *frameAnimationButton; @end @implementation AnimationViewController - (void)viewDidLoad { [super viewDidLoad]; self.frameAnimationButton = [[UIButton alloc]init]; self.frameAnimationButton.frame = CGRectMake(100, 100, 100, 100); self.frameAnimationButton.backgroundColor = [UIColor redColor]; [self.frameAnimationButton addTarget:self action:@selector(doFrameAnination) forControlEvents:UIControlEventTouchDown]; [self.view addSubview:self.frameAnimationButton]; } // 点击执行Frame动画 刚开始的frame (100, 100, 100, 100) 点击以后执行动画 2秒内修改成 (200, 200, 50, 50) 动画执行完成后回到原点 - (void)doFrameAnination { [UIView animateWithDuration:2 animations:^{ self.frameAnimationButton.frame = CGRectMake(200, 200, 50, 50); } completion:^(BOOL finished) { self.frameAnimationButton.frame = CGRectMake(100, 100, 100, 100); }]; } @end
UIView Animation 与 CACoreAnimation
标签:
原文地址:http://www.cnblogs.com/ethan0000/p/4793757.html