views:

98

answers:

2

I can "curl up" a view controller with this code:

[UIView beginAnimations:@"animation" context:nil];
[self.navigationController pushViewController:page animated:NO];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations];

but I can't curl down the last page like this:

[UIView beginAnimations:@"animation" context:nil];
[self.navigationController popViewControllerAnimated:NO];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations];

any idea why not? I just really want to "reverse" the animation (as if a sticker has been peeled off to show the 'push'ed view controller and stuck back on when they click a button).

Thanks

+1  A: 

Using OpenGL or a lot of complex CoreAnimation processes, I am sure that you could, but, It would be a lot of hassle for doing something like that. Something that might help you along: A simple book turning application written entirely with CoreAnimation

Richard J. Ross III
ah... so its not as easy as my (guessed at) code then? thanks for the link. :)
Thomas Clayson
Oddly enough, the code above works just fine for me, but i dont know if thats the transition you wanted..
Richard J. Ross III
it doesn't work for me... :/ maybe if I try it on the device instead of the simulator... :/ i'll get back to you.
Thomas Clayson
still doesn't work for me. :( did you copy the code exactly?
Thomas Clayson
hmm..i just had a dummy uiview and then used the animation described above on the dummy uiview when the background of it was pressed...so i dont know if its a problem with doing it on a navigation controller, or if there a problem with your simulator/device.
Richard J. Ross III
A: 

Ok, my old answer was totally wrong... the problem is that you are popping the view controller before setting the transition view. If you change the code to this:

[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO]; 
[self.navigationController popViewControllerAnimated:NO];
[UIView commitAnimations];

it works fine

Richard J. Ross III
genius. :) thank you.
Thomas Clayson