NSString *navName = @"CMN_navigationItem_bg.png";
@interface MyNavigationBar : UINavigationBar
@end
@implementation MyNavigationBar
- (void)drawRect:(CGRect)rect
{
if (navName == nil)
{
[super drawRect:rect];
}
else
{
UIImage *image = [UIImage imageNamed: navName]; //背景图片
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
}
@end
@implementation UINavigationBar (CoustomNavigation)
+ (Class)class
{
return NSClassFromString(@"MyNavigationBar");
}
@end