UIDocumentPickerViewController navigation bar buttons color

Viewed 6207

My app is using red navigation (2) bar with white buttons and texts. When I use system contact picker (3) the status bar is red. When I use documents picker (1) UIDocumentPickerViewController then navigation bar is white. How I can change color of navigation bar or text?

When I use code bellow, it works but it change my navigation bar too.

UINavigationBar.appearance().tintColor = .red

thanks for help

code:

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

4 Answers

This is the only solution I found:

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

To my knowledge it is not possible to set the bar color only the tint color (text color). To keep the tint color for the rest of your project I reset it in the viewWillAppear of the underlying view controller.

Related