在MFMailComposeViewController中修改UINavigationBar中的tintColor

时间:2013-04-28 02:22:11

标签: ios uinavigationbar

我正在尝试修改MFMailComposeViewController的UINavigationBar中的tintColor,但这似乎不起作用。

   [[UINavigationBar appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setTintColor:[UIColor whiteColor]];
   [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], [MFMailComposeViewController class], nil] setTintColor:[UIColor blackColor]];

在有人引用Apple之前说“邮件撰写界面本身不可自定义且不得被您的应用程序修改”,我之前已经提交了一个应用程序,该应用程序在App Store中正在进行,其中UINavigationBar已在在审查过程中没有任何问题。

当我在整个应用程序中设置这些类的外观时,它会起作用:

   [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
   [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor blackColor];

问题在于我不希望这些外观设置应用于所有UINavigationBar / UIBarButtonItem实例。

我对如何使用appearanceWhenContainedIn:不正确的理解?还是别的什么?

感谢您一如既往的帮助:)

1 个答案:

答案 0 :(得分:5)

这似乎是iOS 6.x中的一个错误,我的Open Radar - http://openradar.me/radar?id=2984402

Apple已对我做出回复,它与之前已知的错误(#12328070)重复,因此应尽快修复。

此代码将在iOS 5中按预期工作。

为了解决这个问题,我建议您在创建MFMailComposeViewController时手动应用所需内容:

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

[mailComposerController.navigationBar setTintColor:[UIColor redColor]];

如果我发现有关该主题的任何其他内容,我会更新我的答案。