UINavigationBar+Additions 클래스를 정의한다. 이는 UINavigationBar을 재정의 하여 뿌려준다.
[sourcecode language="Objc"]
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"custom_nav_bar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
[/sourcecode]
[sourcecode language="objc"]
- (void)drawRect:(CGRect)rect {
UIColor *color = [UIColor redColor];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColor(context, CGColorGetComponents( [color CGColor]));
CGContextFillRect(context, rect);
// 버튼을 위해 tintColor 설정.
self.tintColor = color;
}
[/sourcecode]