MFMailComposeViewController忽略了iOS 7中的一些UIAppearance协议

时间:2013-10-11 13:46:39

标签: ios objective-c ios7 uiappearance messageui

我有一个仅限iOS 7的应用程序,它使用UIAppearance为整个应用程序中的UINavigationBar设置样式。

我的AppDelegate中有以下代码:

[[UINavigationBar appearance] setBackgroundImage:redImage forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setBackgroundImage:blueImage forBarMetrics:UIBarMetricsDefault];

然而,MFMailComposeViewController出现时带有redImage背景!

文档说明如下:

  

重要说明:此类的视图层次结构是私有的,您不能修改它。但是,您可以使用UIAppearance协议自定义实例的外观。

因此,没有理由认为上述内容不起作用,而且我100%确定redImageblueImage是不同颜色的图片。

还有其他人遇到过此问题吗?我猜这是iOS 7中的一个错误,但我没有时间检查iOS 6(我通过使用iPad 4得到这些结果)。

1 个答案:

答案 0 :(得分:2)

您可以直接在MFMailComposeViewController

上设置外观
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
[MFMailComposeViewController.navigationBar setBackgroundImage:blueImage forBarMetrics:UIBarMetricsDefault];