I have a view controller that has the following hierarchy:
UIViewController
|
|-view
|-presentView (UIView)
|-stagedView (UIView)
|-UIToolbar
I am using the transitionFromView:toView:duration:options:completion:
method to animate a page curl up to swap between the presentView
and the stagedView
. The present and staged view only cover most of the screen and there is a UIToolbar at the bottom. When I use the UIViewAnimationOptionTransitionCurlUp
transition, it is animating the whole root view (toolbar included), not just the two views involved.
[UIView transitionFromView:self.presentView
toView:self.stagedView
duration:0.5f
options:UIViewAnimationOptionTransitionCurlUp
completion:^ (BOOL finished) {
if (finished) {
// cleanup code
}}];
I've been struggling with this issue and the only way I could resolve it is that I put the fromView into another view. In your case the view hierarchy should look like this:
UIViewController | |-view |-containerView |-presentView |-stagedView |-UIToolBar
The fromView parameter still should point to presentView. Hope this helps.
This tutorial explains it perfectly.
http://joris.kluivers.nl/iphone-dev/?p=CurlTransition
Basically, you want to create a container view which will be the view we'll be animating, you could call it containerView. This container view will already have a subview added to it which can fill the entire containerView. Then use the code below when you want to animate to the next view. You remove the present view and add the next view. In the end, you are really transitioning between your containerView. Which itself is being changed after the animation begin statement.
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5f];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:containerView cache:NO];
[presentView removeFromSuperview];
[containerView addSubview:nextView];
[UIView commitAnimations];
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