+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations
+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion
+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion
UIView *firstView = [[UIView alloc] initWithFrame:CGRectMake(50,50 , 100, 100)];
firstView.backgroundColor = [UIColor redColor];
UIView *secondView = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 100, 100)];
secondView.backgroundColor = [UIColor blueColor];
secondView.alpha = 0.0;
[self.view addSubview:firstView];
[self.view addSubview:secondView];
[UIView animateWithDuration:3.0 animations:^{
firstView.alpha = 0.0;
secondView.alpha = 1.0;
}
completion:^(BOOL finished){
[UIView animateWithDuration:4.0
animations:^{
secondView.center = CGPointMake(200, 400);
firstView.alpha = 1.0;}];
}];
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/wow09_1225/article/details/47028187