gpt4 book ai didi

ios - UIDocumentPickerViewController 导航栏按钮颜色

转载 作者:技术小花猫 更新时间:2023-10-29 10:58:16 26 4
gpt4 key购买 nike

我的应用使用带有白色按钮和文本的红色导航 (2) 栏。当我使用系统联系人选择器 (3) 时,状态栏为红色。当我使用文档选择器 (1) UIDocumentPickerViewController 时,导航栏为白色。如何更改导航栏或文本的颜色?

当我使用下面的代码时,它有效但它也改变了我的导航栏。

UINavigationBar.appearance().tintColor = .red

感谢帮助

代码:

func open() {
UINavigationBar.appearance().barTintColor = .green
let documentsController = UIDocumentPickerViewController(documentTypes: makeDocumentTypesList(), in: .import)
documentsController.delegate = self
viewControllerProvider.getViewController().present(documentsController, animated: true, completion: nil)
}

navigation bar

最佳答案

您只需将此代码放在您的application:didFinishLaunchingWithOptions: 函数中的某处,即可重置UIDocumentPickerViewController 的外观,条形按钮将恢复为原来的蓝色,否则您可以设置您选择的任何其他颜色。另一方面,条形颜色不可自定义。

if #available(iOS 11.0, *) {
UINavigationBar.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self]).tintColor = nil
}

关于ios - UIDocumentPickerViewController 导航栏按钮颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46363029/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com