I have a UINavigationController
inside a UITabBarController
.
My viewDidLoad
from the navigation controller looks like this:
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationBar.barTintColor = [UIColor blueColor];
self.navigationBar.translucent = NO;
self.navigationBar.topItem.title = @"HOME";
self.navigationItem.title = @"HOME"; // Neither works
// create three funky nav bar buttons
UIBarButtonItem *one = [[UIBarButtonItem alloc]initWithTitle:@"One" style:UIBarButtonItemStylePlain target:self action:@selector(testMethod)];
UIBarButtonItem *two = [[UIBarButtonItem alloc]initWithTitle:@"Two" style:UIBarButtonItemStylePlain target:self action:@selector(testMethod)];
UIBarButtonItem *three = [[UIBarButtonItem alloc]initWithTitle:@"Three" style:UIBarButtonItemStylePlain target:self action:@selector(testMethod)];
// create a spacer
UIBarButtonItem *space = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil];
space.width = 30;
NSArray *buttons = @[one, space, two, space, three];
self.navigationItem.rightBarButtonItems = buttons;
}
Doing this successfully changes my navigation bar to a blue color, but neither the title or the buttons show up. No matter what method I try, I can't seem to get it to have a title. I don't know if it has to do with it being in a tabviewcontroller
or not. Any ideas?
Thanks,