quantum
quantum

Reputation: 1420

How to add a NavigationController to a flipside view?

I have a flipside view showing the settings in my app. I'm trying to have a few levels of tableViews, but how do I implement a navigation controller to allow this? Usually for a normal root view, the navigation controller is by default in the App Delegate. However how do I do it if the root is the flipside?

Thanks.

Upvotes: 2

Views: 836

Answers (1)

Kenny Wyland
Kenny Wyland

Reputation: 21870

You can just create a UINavigationController in the method which displays the flipside. Like so:

- (IBAction)showInfo:(id)sender {    

    FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
    controller.delegate = self;

    controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];

    UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:controller action:@selector(done:)];

    controller.navigationItem.leftBarButtonItem = doneButton;

    [self presentModalViewController:navController animated:YES];

    [doneButton release];
    [controller release];
    [navController release];
}

Upvotes: 4

Related Questions