Reputation: 1207
I have the following issue.
I have a background image for my UINavigationBar so I have to hide all the titles from the Navigation Bars. The problem comes with the "More" Navigation Bar of the TabBarController. I have managed to hide it, but this only happens the first time its shown. When I select an item from within it, and go back, "More" is displayed again.
Im guessing I should disable the title inside some sort of "viewWillAppear" delegate method for the "More" View Controller, yet I have no idea how to do that.
This is the first time I display "More", as you can see, the Logo is there (smudged of course :) ) however, More is not: http://www.flickr.com/photos/68985587@N02/6272805069/lightbox/
This is the View Controller of the first Item in the "More" View Controller: http://www.flickr.com/photos/68985587@N02/6272805241/in/photostream/lightbox/
After I press the "More" left button in the Navigation Bar to go back, I get this: http://www.flickr.com/photos/68985587@N02/6273332152/in/photostream/lightbox/
Thanks for your help!
Upvotes: 1
Views: 2850
Reputation: 201
You can displace the label:
UITabBarItem *i = self.tabBarController.tabBar.items[4];
[i setTitlePositionAdjustment:UIOffsetMake(0., 300.)];
so it has an offset from top that let it disappear...
Upvotes: 0
Reputation: 1293
I suggest you to look at this link here and here
Hig, according to more than 5 icons are not recommended for use. You can search links for TabBar.
Upvotes: 0
Reputation: 1207
The solution came by setting the delegate to the more view controller and acting upon the delegate method.
First, I set the delegate to the "more" view controller (in my case in the appdelegate):
[tbc.moreNavigationController setDelegate:self];
the I proceeded to implement the following method:
-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if([viewController.title isEqualToString:@"More" ])
{
UILabel *label = [[[UILabel alloc] init] autorelease];
viewController.navigationItem.titleView = label;
label.text = @"";
}
}
This effectively gets called not just the first time but everytime the view controller came up. Even when a back button was pressed.
Upvotes: 2
Reputation: 3899
You can check what tab of the UITabBarController was clicked by implementing the delegate method tabBar:didSelectItem:
of UITabBarDelegate. If the fifth item (the "More" item) was clicked, then you can set the title like this:
[[[tabBarController moreNavigationController] visibleViewController] setTitle:@""];
I hope, it works, I haven't tried it. Good luck!
Upvotes: 1