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];
Here’s the code from the link @luvieere mentioned.
Paste this code into to the rootview controller just above
@implementation rootviewControllerAs of iOS 5, there is an official way to do this. (see iOS Developer Library)
But still, retain the old code for backward compatibility unless you really want to ditch iOS 4 and below.