UIViewAnimation

不带block

  • (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache; // current limitation - only one per begin/commit block

带block的翻转

  • (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^ __nullable)(void))animations completion:(void (^ __nullable)(BOOL finished))completion NS_AVAILABLE_IOS(4_0);
    这个方法的animationblock中可以设置子view的hidden属性

  • (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^ __nullable)(BOOL finished))completion NS_AVAILABLE_IOS(4_0); // toView added to fromView.superview, fromView removed from its superview
    此方法默认不通过hidden来翻转,而是通过add和remove不同的子view来翻转.
    但是可以通过设置
    UIViewAnimationOptionShowHideTransitionViews 这个option来改变
    此option参数设置了就不会add remove subview来实现翻转效果,而是通过hidden or Not实现


    UIViewAnimation_第1张图片
    Paste_Image.png

你可能感兴趣的:(UIViewAnimation)