开发者

How to add a NavigationController to a flipside view?

开发者 https://www.devze.com 2023-01-25 03:07 出处:网络
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 n

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

精彩评论

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