I have an app consisting of many views. Each view is controlled by a navigation controller in story board. I would like to use a custom image as the navigation bar. I have created the image but am unsure as to the procedure of implementing this. The code:
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect
{
UIImage *image = [UIImage imageNamed: @"topbar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
Does not seem to work. I am placing this code in the view controller. Should I be using a different method of setting the view controller or have separate controllers for the navigation controllers? If so, how would I do this?
Here’s the layout in storyboard:

Thank you.
Since you’re using iOS 5 you can do this:
You do not need a subclass, you can use a regular UINavigationBar.