如何将NavigationController添加到flipside视图?

时间:2010-11-13 13:39:57

标签: iphone controller navigation tableview

我有一个翻转视图,显示我的应用中的设置。我正在尝试使用几个级别的tableViews,但是如何实现导航控制器以允许这个?通常,对于普通的根视图,导航控制器默认位于App Delegate中。但是,如果根是反面,我该怎么办呢?

感谢。

1 个答案:

答案 0 :(得分:4)

您可以在显示反面的方法中创建UINavigationController。像这样:

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