Orderella / PopupDialog

A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.
http://www.mwfire.de
Other
3.96k stars 522 forks source link

Re-present dialog after being dismissed #350

Closed simonhopkin closed 4 years ago

simonhopkin commented 4 years ago

I have found I needed to re-show a dialog if it was presented and automatically dismissed due to a page change (change in rootViewController). However I found that with a transitionStyle of bounce or zoom the dialog was re-presented with an alpha of 0, so the dialog didn't actually appear but the blurred background did. Using a fade transition style works ok. The reason for the problem is that with the zoom or bounce dismiss transition the alpha of the dialog view is set to 0. It isn't set back to 1 in the presentation transition. This pull request addresses this.

The code below reproduces the issue:

    let popupDialog = PopupDialog(title: "Dialog Title", message: "Dialog Message", transitionStyle: .bounceUp)

    viewController?.present(popupDialog, animated: true, completion: {
        popupDialog.dismiss {
            viewController?.present(popupDialog, animated: true, completion: nil)
        }
    })

You can see the popup initially appears, and is then dismissed. An attempt is made to present the dialog again and all that appears is the background blur.

If you replace the transitionStyle with .fadeIn you can see the popup appear, disappear and re-appear as expected.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.