How to flip an individual UIView (without flipping the parent view)

前端 未结 6 511
一整个雨季
一整个雨季 2020-11-27 15:16

This is an iPad project where I have a UIView with several subViews, and I am trying to animate one of this UIViews using [UIView transitionFromView:toView:duration:options:

6条回答
  •  余生分开走
    2020-11-27 15:29

    I fixed this problem by using old-school animations:

    [UIView beginAnimations:@"Flip" context:nil];
    [UIView setAnimationDuration:1];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:firstView cache:YES];
    
    [self addSubview:secondView];
    
    [UIView commitAnimations];
    

    Additionally you can remove the firstView:

    [firstView removeFromSuperview];
    

提交回复
热议问题