Flip animation between two UIViews on a UIViewController

I have two UIViews on my controller. I wanted to flip between two kinds of user touch. Everything is fine, except for the animation, which I tried two methods, at first was:

[UIView transitionFromView:frontView toView:backView 
duration:01.0 options:UIViewAnimationOptionTransitionFlipFromRight 
completion:NULL];

It was an animation of a view, but actually an animation of the entire view of the view controller, while I only need the part where my views are, which is about 320x200 in the center of the screen.

Then I tried another option which:

[UIView animateWithDuration:1.0 delay:0.0
            options:UIViewAnimationOptionTransitionFlipFromRight 
            animations:^{
        [frontView removeFromSuperview];
        [self.view addSubview:backView];
    } completion:nil];

But this is not a revival of views. Just switching views right away without animation. Can someone help me in understanding where I am wrong or should change. Thank you very much for your time and attention.

+5
source share
1

, , , , , :

UIView ( )

, UIView , , , . . , , . .

+4

All Articles