ios - 更改 QLPreviewController 中的导航栏颜色

标签 ios iphone xcode swift3 ios11

我想在 swift 3 中更改 QLPreviewController 的导航栏颜色。我使用下面的代码来更改颜色,但它不起作用

viewQLPreview = QLPreviewController()
viewQLPreview.dataSource = self
viewQLPreview.delegate = self
viewQLPreview.navigationController?.navigationBar.isTranslucent = false
viewQLPreview.navigationController?.navigationBar.tintColor = UIColor.red

最佳答案

我使用下面的代码在 swift 3.0 中更改 QLPreviewController 的导航栏颜色

UINavigationBar.appearance().barTintColor = UIColor.red

UINavigationBar.appearance(whenContainedInInstancesOf: [QLPreviewController.self]).backgroundColor = UIColor.red

关于ios - 更改 QLPreviewController 中的导航栏颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48821893/

相关文章:

iphone - iOS如何一直保持当前位置中心

Iphone:滚动时 UITableview 中的复选标记会混淆

c++ - C++错误 “_main”,引用自:“Xcode

ios - swift/ios 如何检查我的 TableView 是否嵌入在 uitableview Controller 实例中?

iphone - 阿拉伯字符 ios 中推送通知消息的最大长度

iOS:用户完成输入几秒钟后调用函数

ios - 从电话号码中查找国家代码

xcode - 有没有办法解除在 XCode 中打开自动完成菜单的转义?

ios - objective-c 中 "Template method pattern"的实现

ios - 在 iOS 中检测前景/背景委托(delegate)的适当位置是什么?