Question

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!

Was it helpful?

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..

OTHER TIPS

Here is a bit newer implementation which uses blocks from newer UIView APIs and relies on ARC.

This is how you push new flipping screen:

InfoViewController *controller = [[InfoViewController alloc] init];
[self.navigationController pushViewController:controller animated:NO];


[UIView transitionFromView:self.view
                    toView:controller.view
                  duration:0.8f
                   options:UIViewAnimationOptionTransitionFlipFromLeft
                completion:^(BOOL finished) {

    // Add completion stuff here

}];

And here is the snippet for dismissing it:

[self.navigationController popViewControllerAnimated:NO];

[UIView transitionFromView:controller.view
                    toView:self.view duration:0.8f
                   options:UIViewAnimationOptionTransitionFlipFromRight
                completion:^(BOOL finished) {

    // Add completion stuff here

}];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top