Upv*_*ote 6 objective-c uinavigationbar three20 xcode4.2
自从我更新到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
//....
Run Code Online (Sandbox Code Playgroud)
这应该将背景图像和颜色应用于导航栏.但是自从更新后我得到了默认的蓝色.我在我的项目中使用了three20框架.
知道为什么这不起作用吗?如何在一个位置而不是在每个视图控制器中为所有导航栏设置背景图像?
Tot*_*mus 28
尝试设置:
[[UINavigationBar appearance] setBackgroundImage:myImage forBarMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
在你的 - (void) applicationDidFinishLaunching:(UIApplication *)application
编辑:似乎也有帮助:
[[UINavigationBar appearance] setTintColor:myColor];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22876 次 |
| 最近记录: |