加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

objective-c – 如何在不需要时摆脱UIAppearance?

发布时间:2020-12-16 03:13:52 所属栏目:百科 来源:网络整理
导读:在我的AppDelegate中,我使用UIAppearance设置我自己的NavigationBar与此代码: [[UINavigationBar appearance] setTintColor:[UIColor blackColor]];[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav5.png"] forBarMetrics:UIBa
在我的AppDelegate中,我使用UIAppearance设置我自己的NavigationBar与此代码:
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav5.png"] forBarMetrics:UIBarMetricsDefault];

但是我的应用程序的一些看法不需要它.我如何摆脱它,所以我只能在有意见的视图中使用IB?

解决方法

您不需要使用代理.只要得到实际的导航栏,它应该看起来不一样,直接在它上面设置颜色.
[navigationBarInstance setTintColor:[UIColor blackColor]];
[navigationBarInstance setBackgroundImage:[UIImage imageNamed:@"nav5.png"] forBarMetrics:UIBarMetricsDefault];

您也可以将这两个值都设置为nil,再次选择标准样式. (由本克莱顿测试).

[navigationBarInstance setTintColor:nil];
[navigationBarInstance setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读