Navigation Items in UITableViewController are not appearing?

Posted by Sheehan Alam on Stack Overflow See other posts from Stack Overflow or by Sheehan Alam
Published on 2010-06-16T02:08:01Z Indexed on 2010/06/16 2:32 UTC
Read the original article Hit count: 370

I am displaying a UITableViewController inside of a UITabBarController that is being presented modally:

-(IBAction)arButtonClicked:(id)sender{

   //this is a uitableviewcontroller
    ARViewController* arViewController = [[[ARViewController alloc] initWithNibName:@"ARViewController" bundle:nil]autorelease];

    LeaderBoardTableViewController* lbViewController = [[[LeaderBoardTableViewController alloc] initWithNibName:@"LeaderBoardTableViewController" bundle:nil]autorelease];
    lbViewController.title = @"Leaderboard";

    arTabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
    arTabBarController.viewControllers = [NSArray arrayWithObjects:arViewController, lbViewController, nil];
    arTabBarController.selectedViewController = arViewController;

    [self presentModalViewController:arTabBarController animated:YES];
}

In my viewDidLoad for arViewController method I am setting the navigation items:

- (void)viewDidLoad {
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    self.clearsSelectionOnViewWillAppear = NO;
    self.title = @"AR";

    leaderBoardButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize 
                                                                  target:self 
                                                                  action:@selector(leaderBoardButtonClicked:)];

    self.navigationItem.rightBarButtonItem = leaderBoardButton;

}

My navigation bar doesn't appear when it is inside of the UITabBarController, but when I push the view itself I am able to see it.

What am I missing?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c