I’m stuck at customizing the navigation bar of my app.
I added the navigation controller programmatically.
Indeed, in the method application:didFinishLanchingWithOptions of my app delegate,
I’ve added and hidden a navigation bar using the following code:
self.window.rootViewController = self.viewController;
// ListingNav previously declared as instance variable
self.ListingNav = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.ListingNav.navigationBarHidden = YES;
[self.window addSubView:ListingNav.view];
[self.window makeKeyAndVisible];
return YES;
Now, I’d like to set an image as a navigation bar background, set another background image for the “back” button and add another button on the right side of the same navigation bar with its own background image too. Any idea on how to proceed ?
Thx for helping,
Stephane
Subclass UINavigationBar and override its drawRect method to draw an image.
If your UINavigationController is then created thru InterfaceBuilder, you can easily change the class of the associated UINavigationBar. If you create your UINavigationController thru code, you can use
object_setClass. (this one for example)There is a lot of questions on StackOverflow already on the exact same subject, don’t hesitate to search for “NavigationController background” on the site.