【问题标题】:iOS 8.3 : Why is the navigation bar background color for MFMailComposeViewController still white?iOS 8.3:为什么 MFMailComposeViewController 的导航栏背景颜色仍然是白色的?
【发布时间】:2015-04-17 20:12:44
【问题描述】:

似乎对于 iOS 8.3,无论我做什么,MFMailComposeViewController 的导航栏背景颜色都是白色的。如何正确更改背景颜色?这是我正在使用的代码。简单直接。

    MFMailComposeViewController* myMailViewController = [[MFMailComposeViewController alloc] init];
    myMailViewController.mailComposeDelegate = self;
    [myMailViewController.navigationBar setBackgroundColor:[UIColor orangeColor]];
    [self presentViewController:myMailViewController animated:YES completion:nil];

我尝试了许多其他替代方法,例如更改导航栏的色调,但我得到了相同的结果。这是一个错误吗?任何建议或提示表示赞赏。

【问题讨论】:

  • 如果可以的话,尝试在myMailViewController类的viewWillAppear方法中设置导航栏的背景色。

标签: ios objective-c mfmailcomposeviewcontroller navigationbar


【解决方案1】:
[UINavigationBar appearance].barTintColor = [UIColor yourColor];

这应该在 MFMailComposer 实例化之前调用。

【讨论】:

  • [[UINavigationBar 外观] setBarTintColor:[UIColor grayColor];还有 [[UINavigationBar 外观] setTintColor:[UIColor whiteColor]];
猜你喜欢
  • 2015-05-14
  • 2013-11-09
  • 2018-11-12
  • 1970-01-01
  • 2020-08-12
  • 2014-08-14
  • 1970-01-01
  • 1970-01-01
  • 2018-04-15
相关资源
最近更新 更多