How to add button to UINavigationController.

Posted by Aeolai on Stack Overflow See other posts from Stack Overflow or by Aeolai
Published on 2010-05-20T16:08:32Z Indexed on 2010/05/20 16:30 UTC
Read the original article Hit count: 159

Filed under:
|

I have the following code with adds a navigation controller to a modal view. The nav bar and view all appear ok, but the right button does not. What am I doing wrong?

    UpgradesViewController* upgradesViewController = [[UpgradesViewController alloc] initWithNibName:@"UpgradesView" bundle:nil];
    upgradesViewController.title = @"Upgrades";

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:upgradesViewController];
    navController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    navController.navigationBar.barStyle = UIBarStyleBlack;
    UIBarButtonItem* doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Show" style:UIBarButtonItemStylePlain target: self  action:nil];
    navController.navigationItem.rightBarButtonItem = doneButton;
    [self presentModalViewController:navController animated:YES];

    [navController release];
    [upgradesViewController release];

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c