問題發(fā)現(xiàn):
- 在實(shí)現(xiàn)調(diào)取iPhone本地(ICould)文件時(shí)代碼如下:
func selectUploadFileFromICouldDrive(vc: UIViewController) {
let documentTypes = ["public.item",
"public.content",
"public.text",
"public.source-code",
"public.image",
"public.audiovisual-content",
"com.adobe.pdf",
"com.apple.keynote.key",
"com.microsoft.word.doc",
"com.microsoft.excel.xls",
"com.microsoft.powerpoint.ppt"]
let documentVC = UIDocumentPickerViewController(documentTypes: documentTypes, in: .open)
documentVC.delegate = self
documentVC.modalPresentationStyle = .fullScreen
documentVC.allowsMultipleSelection = false
vc.present(documentVC, animated: true, completion: nil)
}
-
運(yùn)行時(shí)發(fā)現(xiàn)頁面底部出現(xiàn)了灰色區(qū)域
image.png -
進(jìn)而研究發(fā)現(xiàn)窃祝,首頁有TabBar的頁面也都出現(xiàn)了問題:
[圖片上傳中...(image.png-772a52-1694054239879-0)]
1432382-0dcd43f4ff6a0888 (1).png
解決方案:
- 首先感謝UIDocumentPickerViewController在底部顯示空白區(qū)域一文帶來的思路
- 在代碼中找到了UITabBar.appearance()的定制導(dǎo)致的問題:
UITabBar.appearance().backgroundColor = UIColor.white
UITabBar.appearance().backgroundImage = UIImage.colorToImage( UIColor.white)
- 只需要將以下代碼注釋即可
# UITabBar.appearance().backgroundImage = UIImage.colorToImage( UIColor.white)
- 注意:當(dāng)注釋了上訴代碼后逮刨,首頁TabBar內(nèi)的VC的視圖高度會(huì)有變化
- 更多有關(guān)TabBar相關(guān)的定制請(qǐng)移步:
iOS------主題設(shè)置-->Appearance