With the code below (for lower versions of iOS) I am subclassing UINavigationBar and applying to each navigation bar (of each navigation controller) in my UITabBarController.
@implementation CustomNavigationBar
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed:@"customNavigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
The code works fine for the view controllers that are visibly accessible, but when pressing the “More” tab to access the other view controllers, the custom image does not appear any more. Have I missed something?
The way I customise the More View Controller is to ensure that you don’t get the default more controller from the UITabBarController itself – which is what sounds like you are experiencing.
1 Create your own More view controller. It will have its own custom icon
and then
2 When you initialise your UITabBarController, ensure you send five exactly view controllers to the initialiser AND that your custom more view controller is the root view controller of the 5th item – i.e. commonly you would use a navigation controller with your more view controller being set to it’s rootViewController.