views:

46

answers:

1

Hello

I have the following code, which does a nice animation when pushing a new view controller.

[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:0.5];
[[self navigationController] pushViewController:details animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];

This code, using popViewController (rather than pushViewController) doesnt do the animation.

[UIView beginAnimations:@"animationback" context:nil];
[UIView setAnimationDuration:0.5];
[[self navigationController] popViewControllerAnimated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations];

Any ideas why this would be and more importantly; how can I fix it?

+2  A: 

Are you sure that self.navigationController.view really refers to the right view ... the one being animated? I have the feeling that the first case works only by accident. Shouldn't you refer to the view of the controller being pushed / popped?

Max Seelemann
You were correct, but i have a new problem. When it flips, the new view's popped view is on both sides of the flip transition, if you know what i mean. Any ideas?
qui
That's a property of CALayer - you can set it to be one-sided.
Max Seelemann