我有一个简单UITextView的电子邮件链接.textview是可选择的并检测链接.这样,您可以单击电子邮件,它以模态方式打开MFMailComposeViewController视图控制器.
但是,我在应用程序的启动时做了一些自定义:
[[UINavigationBar appearance] setBarTintColor: myGreyColor];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor], NSFontAttributeName: myFont}];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
Run Code Online (Sandbox Code Playgroud)
这样,所有导航栏都是灰色的,带有白色文本和白色按钮,标题具有自定义字体.
我的问题是所有这些都没有应用于邮件编辑器:栏是灰色的,标题是白色,但字体是默认的helvetica neue,按钮是默认的蓝色.而且,状态栏是黑色的,即使我的Info.plist说UIStatusBarStyleLightContent并View controller-based status bar appearance设置为NO.
我知道如何MFMailComposeViewController手动调用它时自定义,但它会自动弹出.如何将我的样式应用于它?
当我使用 swift 3 在 iOS 10 中导航到 MFMailComposeViewController 时,我目前在尝试设置取消和发送按钮颜色时遇到了一些困难。我尝试设置 MFMailComposeViewController 的 UINavigationController、Bar 和 Items 的色调,但没有成功。任何帮助将非常感激。
我如何打开 MFMailComposeViewController:
/* Open mail for the user to send a help emaail with questions about the app */
func sendEmail() {
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setToRecipients(["himom@gmail.com"])
mail.navigationBar.tintColor = UIColor.blue
present(mail, animated: true)
}
}
/* Called when mail is dismissed */
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
controller.dismiss(animated: true)
}
Run Code Online (Sandbox Code Playgroud)