My view right now is containing 3 uitabbaritem
. At the first tab, I am adding a segmentcontroller
to self.navigationItem.titleView
by following
-(void)viewDidLoad {
// Enable 'segmentControl' on navigation bar
self.navigationItem.titleView = self.segmentedControl;
}
What ends up is
Next, when I switch to the second uitabbaritem, I hide the segmentcontroller and name the title for the navigation like below
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
if ( item.tag == 1 ) {
self.navigationItem.titleView.hidden = NO;
}
if ( item.tag == 2 ) {
self.navigationItem.titleView.hidden = YES;
self.title = @"support";
}
}
However, after clicking on the second uitbarbatitem, the title is not displayed on the navigation bar..
Please advice me if you know what I have done wrong. Thanks