UIDocumentPickerController不会在IOS14中占据整个屏幕

问题描述

我正在使用以下代码导入文件

if #available(iOS 14,*) {
        let supportedTypes: [UTType] = [UTType.text,UTType.data]
        let documentPicker = UIDocumentPickerViewController(foropeningContentTypes: supportedTypes,ascopy: true)
        documentPicker.delegate = self
        documentPicker.modalPresentationStyle = .formSheet
       
        self.present(documentPicker,animated: true,completion: nil)
    }

输出中,我们可以看到“最近/浏览器”标签栏和文档内容视图之间的透明视图。

这是输出的屏幕截图:

image 1 image 2

如果我将演示样式更改为全屏,则透明视图将变为灰色视图

documentPicker.modalPresentationStyle = .fullScreen

这是全屏输出的屏幕截图:

image 3 image 4

有人知道如何解决吗?

解决方法

检查 UITabBar.appearance().isTranslucent 属性。 当此属性为 false

时,我遇到了同样的问题