【发布时间】:2012-11-13 10:22:45
【问题描述】:
我的视图控制器的 viewWillAppear 中有以下代码。
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UIImage *image = [UIImage imageNamed:@"navbar.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[self.navigationController.navigationBar addSubview:imageView];
}
如何在添加新导航栏图像之前清除已经存在的导航栏背景图像,如上面的代码所示?
另外,如何以最有效的方式为每个不同的控制器设置不同的导航栏背景图像?谢谢!
【问题讨论】:
-
使用 UIAppearance 设置不同的导航栏样式。见stackoverflow.com/questions/8736171/…
标签: objective-c ios cocoa-touch ios5 ios4