禁用视图控制器的 UIAppearance

Posted

技术标签:

【中文标题】禁用视图控制器的 UIAppearance【英文标题】:Disable UIAppearance for a view controller 【发布时间】:2012-06-09 19:39:01 【问题描述】:

我想禁用所选视图控制器的 UIAppearance 覆盖。

例如。我有一个与我的应用程序设计相匹配的亮橙色 uibarbutton(黑色导航栏)。但它与MFMailComposeViewController(蓝色)并不顺利

有什么建议吗?目前,UIAppearance 设置处于 Appdelegate 级别。

【问题讨论】:

How to get rid of UIAppearance when not needed? 的可能重复项 【参考方案1】:

我只是更新选择器的色调作为解决方法。

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];

picker.navigationBar.tintColor = [UIColor blackColor];
[picker.navigationBar setTranslucent:YES];

【讨论】:

【参考方案2】:

您可以使用UIAppearance 协议的appearanceWhenContainedIn: 方法。例如,您甚至可以继承 UINavigationController,并为您的子类设置外观,而无需在其他 Apple 类上更改 UINavigationController 本身。

【讨论】:

以上是关于禁用视图控制器的 UIAppearance的主要内容,如果未能解决你的问题,请参考以下文章