iOS 简单动画 block动画

 1 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
 2     UIView * view = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
 3     view.backgroundColor = [UIColor orangeColor];
 4     view.alpha = 1;
 5     [self.view addSubview:view];
 6     //动画持续时间为五秒
 7     [UIView animateWithDuration:5 animations:^{
 8         view.alpha = 0;
 9     }completion:^(BOOL finished) {//当动画结束后进行的操作
10         //动画时间为一秒
11         [UIView animateWithDuration:1 animations:^{
12             view.alpha = 1;
13         } completion:^(BOOL finished) {
14             view.backgroundColor = [UIColor blueColor];
15         }];
16     }];
17 }
原文地址:https://www.cnblogs.com/xubaoaichiyu/p/5455499.html