Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1049811
  • 博文数量: 403
  • 博客积分: 10272
  • 博客等级: 上将
  • 技术积分: 4407
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-24 14:22
文章分类

全部博文(403)

文章存档

2012年(403)

分类: 嵌入式

2012-03-07 18:23:32

CustomNavgationBar.m

@implementation UINavigationBar (UINavigationBarCategory)

- (void)drawRect:(CGRect)rect {
//颜色填充
//UIColor *color = [UIColor greenColor];
//CGContextRef context = UIGraphicsGetCurrentContext();
//CGContextSetFillColor(context, CGColorGetComponents( [color CGColor]));
//CGContextFillRect(context, rect);
//self.tintColor = color;
//图片填充
UIColor *color = [UIColor colorWithRed:46.0f/255.0f green:87.0f/255.0f blue:29.0f/255.0f alpha:1.0f];
UIImage *img = [UIImage imageNamed: @"button.png"];
[img drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
self.tintColor = color;

}
@end

CustomNavgationBar.h

- (void)drawRect:(CGRect)rect;

无需引用,在有navbar的地方自动会改变

阅读(329) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~