UIDocumentPickerViewController – How to set the navigation bar color
I want to set the navigation bar background color of my DocumentPicker to be the same as the rest of my application.
let filePicker = UIDocumentPickerViewController(documentTypes: ["public.content"], in: .import) filePicker.delegate = self filePicker.navigationController?.navigationBar.barTintColor = self.theme.navigationBarColor self.present(filePicker, animated: true, completion: nil)
Other things I’ve tried:
UINavigationBar.appearance().backgroundColor = self.theme.navigationBarColor – doesn’t work and looks too much like a workaround instead of a proper way if it works.
Right now our app is redesigned to use the primary color as navigation bar text color, and have the same background color as the DocumentPicker. Answers will still be appreciated.
- UIDocumentPickerViewController dismisses parent view controller
- How to initialise UIDocumentPickerViewController with all type of UTIs
- Swift write/save/move a document file to iCloud drive
- How to use Document Provider Extension?
- My app is getting crashed on UIDocumentPickerViewController
- Add “Edit in Excel” or “Edit photo” extension
Solutions Collect From Internet About “UIDocumentPickerViewController – How to set the navigation bar color”
This will change the color of the text like “Cancel”.
UIBarButtonItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.blue], for: .normal)
and this will change the arrow back color.
UIButton.appearance().tintColor = UIColor.blue
Don’t forget to set it back to your original colors after closing the picker if it required.
- How to unset delegate on UIView setAnimationDelegate: call?
- Is it possible to pause a UIDynamicAnimator without removing and adding UIDynamicBehaviours?
- Whitelisted ios app by Twitter still not getting email of user
- Core Graphics Circular Image Blurry
- Remote notification method called twice
- iOS 7: Custom Back Indicator Image Position
- draw line on MKMapView with pattern image
- Xcode swift failed with exit code 254
- “uppercaseString” and “lowercaseString” on UITextField crash in Swift
- how to center a popoverview in swift
- Split UIImage in half?
- Apply vertical alpha gradient to UITableView
- Instantiating a View Controller programmatically with Storyboard from AppDelegate
- Best architecture for an iOS application that makes many network requests?
- Do I have to retain blocks in Objective-C for iOS?