我正在开发一个应用程序,该应用程序能够从其他云资源导入音频文件,这些资源提供 UIDocumentPickerViewControllerExtenstion 来选择文件,但左上角有一个位置按钮,我想删除它。
下面是我的代码:
let menupicker = UIDocumentMenuViewController(documentTypes: [kUTTypeAudio as String], in: .import)
menupicker.delegate = self
self.present(menupicker, animated: true, completion: nil)
func documentMenu(_ documentMenu: UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {
documentPicker.delegate = self
documentPicker.navigationItem.leftBarButtonItem = nil
self.present(documentPicker, animated: true) {
documentPicker.navigationItem.leftBarButtonItem = nil
documentPicker.navigationItem.backBarButtonItem = nil
documentPicker.navigationItem.hidesBackButton = true
}
}
Best Answer-推荐答案 strong>
我正在寻找相同的解决方案,但找不到。根据我的理解,这是不可能的。
如果你遍历 UIDocumentPickerViewController,它实际上有一个类型为“_UIResilientRemoteViewContainerViewController”的 subview Controller
let picker = UIDocumentPickerViewController(documentTypes: supportDocTypes, in: .import)
picker.delegate = self
present(picker, animated: true) {
print(picker.childViewControllers) // you will get something like this: [<_UIResilientRemoteViewContainerViewController: 0x102e956c0>]
}
这是无法访问的,但是我们可以通过循环访问它,最终您将获得一些其他私有(private)组件,例如_RemoteView。
关于ios - UIDocumentPickerViewController - 隐藏位置按钮,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/45438734/
|