Search code examples
iphoneuiviewcontrolleruinavigationcontrollerflipcommitanimations

flip viewController only flips the first time


I am flipping over to an info view on the backside. I have it flipping, and I have a navigation bar on the other side to get me back home to the original view (which was a problem when I was trying to use a modal).

My problem now is that it only works the first time: I tap the info button, I flip to the backside. I tap the back button and I can flip back no problem.

But, if I tap that info button again, it pushes over to the info view instead of flipping. The flip back is still fine. If I leave the root view and go elsewhere and come back, it flips properly again. In the method that is invoked when I click the info button:

InfoViewController *controller = [[[InfoViewController alloc] init] autorelease];
[UIView beginAnimations:@"animation" context:nil];
[self.navigationController pushViewController: controller animated:NO]; 
[UIView setAnimationDuration:0.8]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations];

Thanks for your help!


Solution

  • where you initializing InfoViewController ? as every time you come on the Root it's getting initialize and working fine... When you click back it doesn't.... so easy fix will be write this code in viewWillAppear...which gets called every time you visit the view..

    Hope this helps..