微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

在我的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];

原文地址:https://www.jb51.cc/c/112162.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐