开发者

How to add a NavigationController to a flipside view?

I have a flipside view showing the settings in my app. I'm trying 开发者_StackOverflowto 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.


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];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜