Reputation: 3014
I have a view controller which is assigned as a rootViewController like below :
self.viewCntrl = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewCntrl;
And in the same view controller i have a button and i am performing transition animation on button click like this:
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view.superview cache:YES];
but it not works when i write like this:
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
As here self is a ViewController's object, the ViewController which is nothing but assigned to self.window.rootViewController. So why it takes self.view.superview instead of self.view to animate?
Upvotes: 0
Views: 1181
Reputation: 69027
Depending on the kind of animation you are trying to execute, possibly the answer is here:
If you want to change the appearance of a view during a transition—for example, flip from one view to another—then use a container view, an instance of UIView, as follows:
Begin an animation block.
Set the transition on the container view.
Remove the subview from the container view.
Add the new subview to the container view.
Commit the animation block.
Upvotes: 1