I am having trouble setting a title for my navbar.
You can see I am trying two different ways to set the title, neither works?! Also, I can't add buttons to the navbar? I CAN set the barStyle just fine! What gives?
Any thoughts are much appreciated!
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UITabBarController *tabBarController = [[UITabBarController alloc] init];
// Init view controllers
GabViewController *gvc = [[GabViewController alloc] init];
VoteViewController *vvc = [[VoteViewController alloc] init];
// Navbar controller, init with root view from Gab View
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:gvc];
nav.navigationBar.barStyle = UIBarStyleBlackOpaque;
nav.navigationItem.title = @"Sayonara Chat";
nav.title = @"Sayonara Chat";
// Tab bar titles and icons
nav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Gab" image:[UIImage imageNamed:@"icon_root.png"] tag:0];
vvc.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Vote" image:[UIImage imageNamed:@"icon_another.png"] tag:1];
// Add to the tab bar, animated
[tabBarController setViewControllers:[NSArray arrayWithObjects:nav,vvc, nil] animated:YES];
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
}
You can see I am trying two different ways to set the title, neither works?! Also, I can't add buttons to the navbar? I CAN set the barStyle just fine! What gives?
Any thoughts are much appreciated!