我想将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相同的背景颜色.答案仍将受到赞赏.