IOS Block动画

时间:2023-03-09 15:37:26
IOS Block动画
● + (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion
方法调用完毕后,相当于执行了下面两句代码:
// 添加toView到父视图
[fromView.superview addSubview:toView];
// 把fromView从父视图中移除
[fromView.superview removeFromSuperview];
参数解析:

● duration:动画的持续时间
● options:转场动画的类型
● animations:将改变视图属性的代码放在这个block中

● completion:动画结束后,会自动调用这个block