一、寫一個category
@implementation UINavigationBar(customImage)
-(void)drawRect:(CGRect)rect{
UIImage *backgroundImage = [UIImage imageNamed:@"背景.png"];
[backgroundImage drawInRect:CGRectMake(0, 0, 320, 44)];
}
@end
二、首先引入#import <QuartzCore/QuartzCore.h>,之後
self._navigationController.navigationBar.layer.contents=(id)[UIImage imageNamed:@"背景.png"].CGImage;
三、將有的navigationBar隱藏掉,自己寫一個,當然返回的方法也得自己來寫了