【发布时间】:2025-11-25 09:55:02
【问题描述】:
因为我更新到 xcode 4.2 和 iOS 5 以下代码无效:
@implementation UINavigationBar (CustomNavBarBG)
-(void)drawRect:(CGRect)rect{
UIImage *image = [UIImage imageNamed:@"navbar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
self.tintColor = [UIColor colorWithRed:124/255.0 green:177/255.0 blue:55/255.0 alpha:1.0];
}
@end
@implementation MyAppDelegate
//....
这应该将背景图像和颜色应用到导航栏。但是自从更新以来,我得到了默认的蓝色。我在我的项目中使用了three20框架。
知道为什么这不起作用吗?如何在一个位置而不是在每个视图控制器中设置所有导航栏的背景图像?
【问题讨论】:
-
更新问题怎么办? *.com/questions/15024037/…
标签: objective-c three20 uinavigationbar xcode4.2