MFMailComposeViewController 的导航栏中的 ios 11 问题

标签 ios swift xcode ios11

我使用下面的代码来呈现一个 MFMailViewController。在 ios 11 发布之前,一切都运行良好。

                let mailViewController = MFMailComposeViewController()
                mailViewController.mailComposeDelegate = self               
                mailViewController.setToRecipients(nil)
                mailViewController.setSubject("Subject")
                mailViewController.navigationBar.tintColor = UIColor.green
                UINavigationBar.appearance().isTranslucent = false
                self.present(mailViewController, animated: true, completion:  nil)

无论我使用什么代码,都不起作用。我能够展示一个 controller ,但导航栏的色调颜色没有改变。此问题仅适用于 ios 11。我已将整体应用程序导航栏色调颜色设置为白色。因此在 Controller 中我得到的是白色而不是绿色。

最佳答案

我终于找到问题所在了。我在其中一个文件中全局修改了 UIBarButton。

UIBarButtonItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.theme, NSFontAttributeName : UIFont.regularAppFontOfSize(0.0)], for: UIControlState.normal)

尽管我使用了 mailViewController.navigationBar.tintColor = UIColor.green ,但由于全局修改,它没有任何效果。

但令人惊讶的是,在ios 10及以下没有问题,但在ios 11中。

如果有人知道原因,不胜感激。

关于MFMailComposeViewController 的导航栏中的 ios 11 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47483682/

相关文章:

Xcode:如何关闭源代码窗口中的编译器错误消息?

swift - 如何获得 slider 来更改 Swift 中的背景颜色?

iphone - 如何在iphone项目中添加C++文件

objective-c - 将应用程序带到前台后 UIAlertView 不可见

ios - UIScrollView:无限滚动显示斐波那契数

ios - Swift UIImageView 始终为空

ios - 选择 HealthKit HKActivitySummary -> "NSInvalidArgumentException", "startDateComponents: Date components require a calendar."

objective-c - 调整 UIButton 上的图像

iphone - 按下主页按钮后,如何在背景中对图像进行动画处理?

ios - 如何为 ios 拍摄 AGSMapView 的快照?