【发布时间】:2017-09-14 20:37:26
【问题描述】:
我有一个示例项目,可以在应用启动时设置条形颜色:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
UINavigationBar.appearance().barTintColor = UIColor.red
return true
}
它有 1 个视图控制器(在 UINavigationController 内部),其中包含以下代码:
@IBAction func launchDocument(_ sender: Any) {
if let url = Bundle.main.url(forResource: "example", withExtension: "pdf") {
let controller = UIDocumentInteractionController(url: url)
controller.delegate = self
controller.presentPreview(animated: false)
}
}
func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
return self
}
在 iOS 10 中,主视图控制器和 UIDocumentInteractionController 都有红色导航栏。在 iOS 11 中,UIDocumentInteractionController 不是红色的。这是 iOS 11 的错误吗?还是有其他方法可以做到这一点?
附: - 我知道我可以在委托中返回 self.navigationController,但我需要 UIDocumentInteractionController 有一个“完成”按钮,而不是一个“返回”按钮
【问题讨论】:
-
有什么解决办法吗?