iOS Modal ViewController Background Appears Black Instead of Transparent

I am presenting a UIViewController modally using the following code:

let fileTypePopUP = FileTypePopUP(nibName: "FileTypePopUP", bundle: nil)
fileTypePopUP.delegate = self
fileTypePopUP.modalPresentationStyle = .fullScreen
self.present(fileTypePopUP, animated: true)

Inside FileTypePopUP, my view has a transparent background, and a subview covering half of the screen height. The problem is that instead of showing the background as transparent, the full-screen modal displays a black background.

What I Tried:

Expected Outcome: I want the background to be transparent, so the presenting view controller remains visible behind the modal.

enter image description here

after using .modalPresentationStyle = .overFullScreen i got space at top and bottom as in this image

enter image description here

Upvotes: -2

Views: 48

Answers (1)

Shehroz
Shehroz

Reputation: 11

Check the top and bottom constraints of the presented view(FileTypePopUP view). The constraint should match the top and bottom of the SuperView instead of the SafeArea.

Upvotes: -1

Related Questions