ios - 如何仅为某些 View Controller 自定义 UINavigationBar

标签 ios objective-c

[[UINavigationBar appearance] setBackgroundImage:gradientImage44
                                   forBarMetrics:UIBarMetricsDefault];

将自定义 UINavigationBar

说我有课
BGImageBookController

我希望 BGImageBookController 顶部的 UINavigationBar 具有不同的背景。我该怎么做?

我在 viewDidload 中做了这个
- (void)viewDidLoad
{
    [super viewDidLoad];

    [[UINavigationBar appearanceWhenContainedIn:[BGImageBookController class], nil] setBackgroundImage:[UIImage imageNamed:@"sushi_eating_cat"] forBarMetrics:UIBarMetricsDefault];
}

没有效果

最佳答案

这是你的代码:

[[UINavigationBar appearanceWhenContainedIn:[BGImageBookController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

关于ios - 如何仅为某些 View Controller 自定义 UINavigationBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17472644/

相关文章:

ios - FBDialog 照片分享问题

ios - 如何在 Playground 上编译 Storyboard

ios - RKRequestDelegate TotalBytesExpectedToReceive 始终返回 -1

android - 我们可以在 iOS - android 中使用 iBeacon 通过蓝牙传输数据吗?

iphone - 在 iPad 设备上测试应用程序

ios - 如何访问以编程方式创建的按钮?

ios - 如何在 UITableViewCell 中使用字典显示 NSArray 对象

objective-c - 根据标签更改 UIButton 的颜色

ios - 图片未存储在sqlite中

ios - AVPlayerview来自左上角