【发布时间】:2012-01-07 16:12:46
【问题描述】:
我有以下代码-sn-ps:
1.)
[[UINavigationBar appearance] setBackgroundImage:myImage forBarMetrics:UIBarMetricsDefault];
我会把它放在哪里?
或 2.)
@implementation UINavigationBar (BackgroundImage)
//This overridden implementation will patch up the NavBar with a custom Image instead of the title
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"NavigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
我会把它放在哪里?
我已经尝试在我的视图控制器中添加一个导航栏,但我不知道将这些代码放在哪里。
【问题讨论】:
-
您还可以询问您需要自定义什么,例如更改整个导航颜色/bar/titleImage...等。
-
问题似乎是重复的,您可以参考以下线程 - stackoverflow.com/questions/704558/…
标签: iphone objective-c xcode uinavigationbar