首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

iOS-替UINavigationBar添加自定义背景

2012-09-07 
iOS-为UINavigationBar添加自定义背景@implementation UINavigationBar (UINavigationBarCategory)- (void

iOS-为UINavigationBar添加自定义背景


iOS-替UINavigationBar添加自定义背景

@implementation UINavigationBar (UINavigationBarCategory)- (void)drawRect:(CGRect)rect {//颜色填充//UIColor *color = [UIColor redColor];//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: @"bg.png"];[img drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];self.tintColor = color;}@end

热点排行