PopupDialog icon indicating copy to clipboard operation
PopupDialog copied to clipboard

Black background when ViewController 'modalPresentationStyle' changes to FullScreen

Open saeid-pm opened this issue 5 years ago • 1 comments

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:

Simulator Screen Shot - iPhone 11 Pro Max - 2020-12-14 at 17 06 54

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.

saeid-pm avatar Dec 15 '20 16:12 saeid-pm

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

Nanduhirion avatar Sep 19 '22 07:09 Nanduhirion