2016-11-03 5 views
3

swift 3を使用してiOS 10のMFMailComposeViewControllerに移動するとき、現在、キャンセルと送信ボタンの色を設定しようとしています。MFMailComposeViewControllerのUINavigationControllerの色合いを設定しようとしましたが、バー、アイテムを含むことができます。どんな助けでも大歓迎です。MFMailComposeViewControllerのナビゲーションバーの項目の色を設定します

What my current MFMailComposeViewController looks like

私は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(["[email protected]"]) 
      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

はコンコントローラのビュー自体の色合いを設定してみてください。 –

+0

@LeoNatanはメールオブジェクトの初期化の前に 'self.navigationController?.navigationBar.tintColor = UIColor.blue'を追加しようとしましたが、それは助けになりませんでした。 – user3459799

+0

いいえ。 'mail.view.tintColor = .blue'を試してください –

答えて

2

あなたは、あなたの全体のアプリケーションのためのナビゲーション色をしたい場合、あなたはこれを試すことができます。

func application(_ application: UIApplication, didFinishLaunchingWithOptionsAppDelegate

// Custom color for navigation bar 
UINavigationBar.appearance().tintColor = UIColor.whateverTintColorYouWant 
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whateverTextColorYouWant] 

あなただけのこのようMailViewControllerのためにこれをしようとした場合:

// Custom color for navigation bar 
mail.navigationController?.navigationBar.tintColor = UIColor.aColorYouwant 
mail.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.aColorYouWant] 
+0

AppDelegateから背景色とタイトル色を設定できました。私はボタンの色を設定することができませんでしたので、背景とタイトルの色を変更して、whileボタンを操作して表示されるようにしました。助けてくれてありがとう。 – user3459799

関連する問題