Alexander
Alexander

Reputation: 436

UIDocumentPickerViewController displays empty space at the bottom

Code for the thing

let fileBrowser = UIDocumentPickerViewController(documentTypes: listOfAllTypesOfFiles, in: UIDocumentPickerMode.open)
fileBrowser.allowsMultipleSelection = false
fileBrowser.delegate = self
            
navigationController?.present(fileBrowser, animated: true, completion: nil)

Not sure why, but it shows that empty space at the bottom. Anyone knows what that is?

This is how it looks

Upvotes: 0

Views: 706

Answers (3)

I had a similar problem. In my case it was

UITabBar.appearance().isTranslucent = false

I created my own UIDocumentPickerViewController and am using it.

final class SbisDocumentPickerViewController: UIDocumentPickerViewController {
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        
        let toolbar = UIToolbar.appearance()
        toolbar.isTranslucent = true
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        
        let toolbar = UIToolbar.appearance()
        toolbar.isTranslucent = false
    }
}

Upvotes: 0

revilo
revilo

Reputation: 179

It turns out that I had a global appearance() customisation causing issues with the document picker.

In my case this was the line causing the issue, removing it enabled the UIDocumentPickerViewController to display correctly.

UITabBar.appearance().isTranslucent = false

I've applied the appearance to my UITabBar directly instead of globally.

Alexander above (although downvoted) helped track the solution. Hope this helps whoever comes after.

Upvotes: 1

Alexander
Alexander

Reputation: 436

Found the issue. It was customizing tab bar via appearance. In particular that big chunk of view was some messed up version of shadow image which looks fine in main app, but not so much there. Don't customize your stuff like that people :)

Upvotes: 1

Related Questions