5

完了ボタンの背景色とテキストの色を変更するにはどうすればよいですか?ナビゲーションバーの色とナビゲーションバーのタイトルカラーとボトムバーカラーを変更する方法はありますか? enter image description hereUIDocumentInteractionControllerを変更する方法ボタンのテキストと背景の色を完了

+0

ここでスクリーンショット – paper1111

+0

私は添付のスクリーンショットを見ることができます。あなたには見えませんか?もう一度アップロードする必要がありますか? – Dee

+0

今すぐ見ることができます。今は「imgurが容量を超えています」 – paper1111

答えて

0

私はバーの色を変更するidearを持っている:参照用のスクリーンショット添付

let allNavigationBar = UINavigationBar.appearance() 
allNavigationBar.barTintColor = UIColor.red // change the bar background color 
allNavigationBar.tintColor = UIColor.black // change the Done button's tintColor 

let alloolbar = UIToolbar.appearance() 
allToolbar.barTintColor = UIColor.red // dones't work, try backgroundImage 
allToolbar.backgroundColor = UIColor.blue // dones't work 
allToolbar.tintColor = UIColor.brown // change the toolbar's item tint color 

をしかし、この方法では大きな効果があり、すべてのあなたのUINavigationBarUIToolBarは、その変更を行います。

他の誰かがより良い解決策を与えることを望みます。

0

ウィンドウの色合いを時間的に変更することができます。

func presentDocument() { 
    //present the controller here 
    self.appDelegate.window.tintColor = UIColor.red 
} 

その後、後で戻ってそれを変更します。

func documentInteractionControllerDidEndPreview(documentInteractionController) { //replace parameter with your uidocumentviewinteractioncontroller 
    self.appDelegate.window.tintColor = UIColor.white 
} 
0

@Dee。私はあなたが他の質問の一つでこの部分を尋ねたと思います。その場合、プレビューコントローラを表示できませんでした。その質問では、答えはそのデリゲートメソッドから "self"を返すことです。これを正しく実装すると、親コントローラが使用しているのと同じナビゲーションバーの色がプレビューで使用されます。つまり、あるViewControllerから直接UIDocumentInteractionControllerを開いた場合、UIDocumentInteractionControllerは親viewControllerのナビゲーションバーの色を使用します。これは、完了ボタンの色を変更するのに役立ちます

+0

ナビゲーションバーボタンのタイトルとテキストと背景色を変更できるようになりました。下のツールバーの色は機能しません。 – Dee

+0

@Deeナビゲーションバーのボタンのタイトルとテキストと背景の色を変更できません。あなたはどうしましたか? –

0

私はそれを解決しました。ここでのコードは完全に私のために働いている:そのはQLPreviewControllerがUIDocumentInteractionControllerを実装するクラスであるが、このようなものは、少なくとも侵入ソリューションであるという事実に頼るよう

func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController { 
    UINavigationBar.appearance().barTintColor = Colors.redColor() 
    UINavigationBar.appearance().tintColor = UIColor.white 
    UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white, NSFontAttributeName: UIFont.systemFont(ofSize: 14, weight: UIFontWeightBold)] 
    return self 
} 
-1
 let QLNavAppearance = UINavigationBar.appearance(whenContainedInInstancesOf: [QLPreviewController.self]) 
    QLNavAppearance.tintColor = UIColor.red // some 
    QLNavAppearance.barTintColor = UIColor.red // some 
    QLNavAppearance.backgroundColor = UIColor.red // some 
0

それは少しハックです。それはあなたがUIDocumentInteractionControllerを表示する前に行います

import QuickLook 

UIBarButtonItem.appearance(whenContainedInInstancesOf [QLPreviewController.self]).tintColor = UIColor.black 
関連する問題