iOS13 UIDocumentPickerViewController-打开目录不显示选择/打开/取消按钮

iOS13 UIDocumentPickerViewController-打开目录不显示选择/打开/取消按钮,ios,swift,xcode,ios13,uidocumentpickerviewcontroller,Ios,Swift,Xcode,Ios13,Uidocumentpickerviewcontroller,我正在使用UIDocumentPickerViewController浏览并让用户选择一个目录,但在iOS 13上显示此UIDocumentPickerViewController时,应显示为“选择/取消”和“打开/完成”的按钮不会显示,但当您点击该位置时,其行为与按钮可见时的行为类似。此外,这个问题仅在iOS 13上出现。使用相同的代码,这些按钮显示在iOS 12上。谢谢你的帮助 对于AppDelegate didFinishLaunchingWithOptions中的UIDocumentBr

我正在使用UIDocumentPickerViewController浏览并让用户选择一个目录,但在iOS 13上显示此UIDocumentPickerViewController时,应显示为“选择/取消”和“打开/完成”的按钮不会显示,但当您点击该位置时,其行为与按钮可见时的行为类似。此外,这个问题仅在iOS 13上出现。使用相同的代码,这些按钮显示在iOS 12上。谢谢你的帮助

对于AppDelegate didFinishLaunchingWithOptions中的UIDocumentBrowserViewController实例,我确实将导航栏的着色颜色设置为零

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


//Here is how UIDocumentPickerViewController is created and presented
let documentPickerViewController = UIDocumentPickerViewController(documentTypes:["public.folder"], in: .open)
...
...
...

self!.documentPickerViewController.delegate = self!
self!.documentPickerViewController.allowsMultipleSelection = true
self!.documentPickerViewController.modalPresentationStyle = .fullScreen     

self!.navigationController?.present(self!.documentPickerViewController, animated: true, completion:nil)
这是一个截图

编辑: 这是视图层次结构-不确定为什么在iOS 13上使用DOCExportModeViewController。在iOS 12上,它是用于相同代码的UIDocumentBrowserViewController。有没有办法解决这个问题


我观察到,
UIDocumentPickerController
UIViewController
的子类,其中
UIImagepickerController
UINavigationController
的子类

如果您尝试为UIImagePickerController设置
navBar
tintColor
,您可以直接访问它,如
imagePicker.navigationBar.tintColor=.red
,进入文档选择器,您无法直接访问
navigationBar
。您可以通过
imagePicker.navigationController?.navigationBar.tintColor=.red
访问它。这里的
导航控制器是可选的
。这就是我们无法直接访问导航栏并进行更改的原因

苹果用文档选择器创建了一个应用程序。请参阅此处的源代码:


如果在多个位置使用document ViewController或任何其他选择器,我发现了此快速修复方法:

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

如果您担心某个位置或在不同的位置有不同的颜色,您可以在
视图中设置淡色将出现
,然后在
视图中重置淡色将消失
方法。

您的第一个建议不起作用,我无法全局设置淡色。我已更新了答案,如果我错了,请更正。我观察到这种行为在灯光模式下,按钮似乎在那里,但白色对白色,因此不可见。这就是为什么他们仍然通过了解自己的位置来工作。