Currently, I have a view that is contained in the view. The main view controller (parent view) has a property that is connected to the subzone in the interface builder. There is a button in the preview. I want the button to switch the subview, keeping the main view still. Currently, I have the following code in my IBAction for a button:
[UIView transitionWithView: self.subViewFront duration: 1.0 options: UIViewAnimationOptionTransitionFlipFromTop animations: nil completion: nil]; [UIView commitAnimations]; [[self view] addSubview: self.subViewBack;
This code works fine, however, I noticed the following when I looked at the Apple API link:
Using the methods in this section is not recommended in iOS 4 and later. Use block-based animation methods instead.
Following this tip, I tried using the following code:
[UIView transitionFromView: self.subViewFront toView: self.subViewBack duration: 1.0 options: UIViewAnimationOptionTransitionFlipFromTop completion: nil];
It seems like it should do the same as what I originally encoded, however, when I run my application with this code, it flips my whole mind (parent and child), and not just the preview. Should this method be used as a replacement from the original method I used, or is there something I am missing? Thanks.
source share