【发布时间】:2015-12-31 20:11:58
【问题描述】:
我正在使用MFMailComposeViewController 撰写邮件并在我的应用中添加附件。
我的AppDelegate.m中有这个代码
[[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[UIImage new]];
[[UINavigationBar appearance] setTranslucent:NO];
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0x0A/255.0f green:0x13/255.0f blue:0x1A/255.0f alpha:1]];
然后我使用此代码在另一个 UIViewController 中创建 MFMailComposeViewController
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
[mailViewController.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
mailViewController.mailComposeDelegate = self;
[self presentViewController:mailViewController animated:YES completion:nil];
但是,MFMailComposeViewController 中的UINavigationBar 是暗的,为什么它没有“重置”到我在呈现之前指定的背景?是不是继承了当前UIViewController的颜色?
【问题讨论】:
-
它很暗,因为您将背景图像设置为 nil。你想要它是什么?
-
@JasonNam 以为我在某处读到它会将颜色重置为默认值。这是我的目标,让它在撰写时就像在本机邮件应用程序中一样显示
-
啊,您可以将 nil 分配给 tintColor 而不是背景图像。
标签: ios objective-c uinavigationcontroller uinavigationbar mfmailcomposeviewcontroller