create custom uinavigationbar – quickstart

did you ever want to customize the appearance of a the navigation bar of your uinavigationcontroller instance more than only use its few style properties like tintcolor or translucent?

so dont’t worry, there are only two major steps to REALLY customize your navigation bar. we will do this by simply set a custom background image for your customized uinavigationbar:

1. go to your app-delegate implementation (.m) file und add the following lines of code on top of the file:

@interface UINavigationBar (MyCustomNavBar)
@end
@implementation UINavigationBar (MyCustomNavBar)
- (void) drawRect:(CGRect)rect {
    UIImage *barImage = [UIImage imageNamed:@"some_image.png"];
    [barImage drawInRect:rect];
}
@end

2. replace the image source i wrote bold “some_image.png” with your own image  you added to your xcode project.

voila! now you can go on and build your uinavigationcontroller instances like you did before and they will automatically use your custom uinavigationbar with your custom background image you defined just before.