Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black background when ViewController 'modalPresentationStyle' changes to FullScreen #361

Open
saeid-pm opened this issue Dec 15, 2020 · 1 comment

Comments

@saeid-pm
Copy link

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.

@Nanduhirion
Copy link

Nanduhirion commented Sep 19, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants