views:

1435

answers:

1

I currently have a UINavigationController based application that works just fine. I'd like to take one of the view controllers that's a few levels deep into the UINavigationController stack to have a "flip side" type view as demonstrated by Utility apps, etc. Very common thing.

The problem here is that I created an intermediate view controller to manage both the view controllers that will be flipping back and forth. Now the intermediate view controller intercepts and overrides the navigationBar with its own within the hierarchy. The navigationBar from the existing view controller gets masked and its entire view gets shifted down.

I've tried doing something like:

myFlipViewController.view = myOriginalViewController.view;

That breaks my entire view from myOriginalViewController as it has its own navigationItems. I basically just want myFlipViewController to act as a transparent proxy that will control flipping myOriginalViewController and othersideViewController. The navigationItems from myOriginalViewController should still show up.

I've tried an assortment of setNavigationBarHidden amongst the view controllers, but nothing seems to be doing the trick.

What's the best way to introduce a flipViewController in the middle of a UINavigationController stack without making it get in the way?

+4  A: 

@implementation YourViewControllerInTheMiddleOfTheStack

- (void)presentFlipSideViewController:(UIViewController *)flipsideViewController
{
    flipsideViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self.navigationController presentModalViewController:flipsideViewController animated:YES];
}

@end
hatfinch
What's wrong with this code? The modal view controller should obscure the navigation bar - you can then use your own "fake" navigation bar or leave it out entirely. Seems like the best solution.
pix0r
seems like an easy way to do what you want. Much better than the alternative.
Corey Floyd