I have two UIViews on my view controller. I wanted to flip between the two views on user touch. Everything is fine except the animation I tried two methods, first was:
[UIView transitionFromView:frontView toView:backView
duration:01.0 options:UIViewAnimationOptionTransitionFlipFromRight
completion:NULL];
This was animating the view but actually animating the whole view controller's view, while I wanted only the portion where my views are, which is about 320x200 in the centre of the screen.
Then I tried the other option, which is:
[UIView animateWithDuration:1.0 delay:0.0
options:UIViewAnimationOptionTransitionFlipFromRight
animations:^{
[frontView removeFromSuperview];
[self.view addSubview:backView];
} completion:nil];
But this is not animating the views at all. Just switching the views instantly without any animation. Can anyone please help me in understanding where I am wrong or need to change. Thanks very much for your time and consideration.
Awhile after I posted my question I found a great answer for this query which you guys can look at :
How to flip an individual UIView (without flipping the parent view)
The trick is to use third UIView as container view and then adding the views, which needs to be animated, as subviews on it. That does the trick in my case. Remember that I am using the first method that I mentioned in my question. Thanks everyone for your time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With