当我使用swift 3导航到iOS 10中的MFMailComposeViewController时,我目前在尝试设置取消和发送按钮颜色时遇到了一些困难。我尝试设置MFMailComposeViewController的UINavigationController的色调,条形图和项目没有成功。任何帮助将不胜感激。
我如何打开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)
}
答案 0 :(得分:2)
如果您想要整个应用程序的导航颜色,即按钮的色调在整个应用程序中匹配,您可以尝试:
在gci "J:\Logs" -include "*.txt" -file -recurse | % {ren $_ "report.txt"}
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("safebrowsing.enabled", "false");
prefs.put("safebrowsing.malware.enabled", "false");
prefs.put("download.prompt_for_download", "false");
prefs.put( "profile.content_settings.pattern_pairs.*.multiple-automatic-downloads", 1 );
prefs.put("download.default_directory", downloadDir);
options.setExperimentalOption("prefs", prefs);
内
func application(_ application: UIApplication, didFinishLaunchingWithOptions
如果你只想为MailViewController这样做,试试这个:
AppDelegate
答案 1 :(得分:0)
我的最终答案是来自这里的第一条评论:How to change color of MFMailComposeViewController texts and button images? 你必须在哪里设置
mail.view.tintColor = .green
然后我的按钮显示为绿色。