我的情况是,我试图根据我的应用主题更改QLPreviewController默认的导航栏背景颜色和栏按钮项目颜色。我使用了下面的代码,但是它不起作用。
UINavigationBar.appearance(whenContainedInInstancesOf: [QLPreviewController.self]).isTranslucent = false
UINavigationBar.appearance(whenContainedInInstancesOf: [QLPreviewController.self]).backgroundColor = #colorLiteral(red: 0.9003542662, green: 0.417613821, blue: 0.147166098, alpha: 1)
UINavigationBar.appearance(whenContainedInInstancesOf: [QLPreviewController.self]).tintColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
UINavigationBar.appearance(whenContainedInInstancesOf: [QLPreviewController.self]).titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]