I want to add an image background to my navigation bar.
Is it right?
//set custom background image
UIImageView *backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NavigationBackground.png"]];
[self.navigationBar insertSubview:backgroundView atIndex:0];
[backgroundView release];
You could also add a category that extends the UINavigationBar class and override the drawRect: method in the category.
Try this code in your AppDelegate Class to show image at navigation bar. It will help you alot.
The easiest way is just set the
UINavigationBar
layer contents.The downside is the buttons are not generated off the proper tint but you can set the navbar color to whatever is closest to your bg image and the tint should be taken care of.
When iphone 5 come we have to set both device type. So use this
For more info go to this link
This one working fine in iOS 6 and 7
in ios5 , I set the navigation bar background image(for all the navigation bar image) in
AppDelegate.m
: