2017-09-22 23 views
5

私のアプリは白いボタンとテキストの赤いナビゲーション(2)バーを使用しています。システム連絡先ピッカー(3)を使用すると、ステータスバーは赤色になります。ドキュメントピッカー(1)UIDocumentPickerViewControllerを使用すると、ナビゲーションバーが白くなります。ナビゲーションバーやテキストの色をどのように変更できますか?UIDocumentPickerViewControllerナビゲーションバーのボタンの色

コードを使用すると機能しますが、ナビゲーションバーも変わります。

UINavigationBar.appearance().tintColor = .red 

ヘルプ

コードのための感謝:それはない、私の知る限り

UINavigationBar.appearance().tintColor = ... some color 
    _viewController?.present(documentPicker, animated: true) 

func open() { 
     UINavigationBar.appearance().barTintColor = .green 
     let documentsController = UIDocumentPickerViewController(documentTypes: makeDocumentTypesList(), in: .import) 
     documentsController.delegate = self 
     viewControllerProvider.getViewController().present(documentsController, animated: true, completion: nil) 
    } 

navigation bar

+0

使用 'UINavigationBar.appearance()。bartintColor = .green' –

+0

いくつかの追加のコード –

+0

私はbarTintColorを設定すると、それがルート・ビュー・コントローラの色を変化させる示します。ドキュメントピッカーで効果がありません。 –

答えて

1

は、これは私が見つけた唯一のソリューションですバーカラーのみ色合い(文字色)のみを設定することができます。残りのプロジェクトの色合いを維持するため、基になるビューコントローラのviewWillAppearでリセットします。

2

使用setTitleTextAttributes

UIBarButtonItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.white], for: .normal) 

see my answer here

関連する問題