PopupDialog
PopupDialog copied to clipboard
Black background when ViewController 'modalPresentationStyle' changes to FullScreen
Report
Environment
- Xcode version: 12.0
- PopupDialog version: V 1.1.1
- Minimum deployment target: 11
- Language (Objective-C / Swift): Swift
- In case of Swift - Version: 5
Dependency management
- Dependency manager (e.g. CocoaPods): CocoaPods
- Version: 1.9.1
What did you do?
func showPopup() {
let popup = PopupDialog(title: "title", message: "message", transitionStyle: .fadeIn, hideStatusBar: true)
let buttonOne = DefaultButton(title: "close", action: nil)
popup.addButtons([buttonOne])
present(popup, animated: true, completion: nil)
}
And laso adde:
let ov = PopupDialogOverlayView.appearance()
ov.blurEnabled = true
ov.blurRadius = 30
ov.liveBlurEnabled = true
ov.opacity = 0.7
ov.color = .black
What happened?
This issue happens when following Func is added (for presenting modal in iOS 13 fullscreen)
override func present(_ viewControllerToPresent: UIViewController,
animated flag: Bool,
completion: (() -> Void)? = nil) {
viewControllerToPresent.modalPresentationStyle = .fullScreen
super.present(viewControllerToPresent, animated: flag, completion: completion)
}
then show the PopupDialog with black background:

And if .fullScreen changes to .overFullScreen, the background Blur effect will disappear and just show Popup without any effect.
Also, I tested this issue with Example project in repo and got the same result.
I had the same problem. Turns out you have to set the view controller's modalPresentationStyle to ".overFullScreen".
ov.modalPresentationStyle = .overFullScreen
See: Popup has black background even though it is set to clear