Agu*_*orn 10 ios swift uidocumentpickervc
我想将DocumentPicker的导航栏背景颜色设置为与我的应用程序的其余部分相同.
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)
Run Code Online (Sandbox Code Playgroud)
不起作用.
我试过的其他事情:
使用UINavigationBar.appearance().backgroundColor = self.theme.navigationBarColor- 不起作用,看起来太像一个变通方法而不是一个正确的方法,如果它的工作原理.
编辑:现在我们的应用程序被重新设计为使用主要颜色作为导航栏文本颜色,并具有与DocumentPicker相同的背景颜色.答案仍将受到赞赏.
这将改变文本的颜色,如“取消”。
UIBarButtonItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.blue], for: .normal)
Run Code Online (Sandbox Code Playgroud)
这将改变箭头的颜色。
UIButton.appearance().tintColor = UIColor.blue
Run Code Online (Sandbox Code Playgroud)
如果需要,请不要忘记在关闭选择器后将其设置回原始颜色。