Try putting any of these codes into ViewWillAppear/ViewDidAppear/didFinishLaunchingWithOptions
(in case of appDelegate).
1)navigationItem.titleView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"urtitlebar.png"]];
OR
2)
UIView *myView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 44)];
UIImageView *image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"urtitlebar.png"]];
[image setFrame:CGRectMake(0, 0, 44, 44)];
[myView addSubview:image];
[self.navigationController.navigationBar addSubview:myView];
OR
3)
UINavigationBar *navBar = self.navigationController.navigationBar;
UIImage *image = [UIImage imageNamed:@"urtitlebar.png"];
[navBar setBackgroundImage:image];
EDIT:(in case you're using old version of SDK say 3.2.5)
Create the subview of UINavigationBar
and override the method called -drawRect:(CGRect)rect
with,
@implementation UINavigationBar (BackgroundImage)
- (void)drawRect:(CGRect)rect
{
UIImage *navBarImage;
image = [UIImage imageNamed: @"urNavigationBar.png"];
}
[navBarImage drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end