1

By using following method to call popup

func annoucementdisplay()
{
    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let ivc = storyboard.instantiateViewController(withIdentifier: "PopUpViewController") as! PopUpViewController
    ivc.modalTransitionStyle = .crossDissolve
    ivc.modalPresentationStyle = .custom
    let quiclvw = UIWindow(frame: UIScreen.main.bounds)
    quiclvw.windowLevel = UIWindow.Level.alert
    quiclvw.rootViewController = UIViewController()
    quiclvw.makeKeyAndVisible()
    let transition = CATransition()
    transition.duration = 1.0
    transition.type = CATransitionType.reveal
    transition.subtype = CATransitionSubtype.fromBottom
    quiclvw.layer.add(transition, forKey: kCATransition)
    quiclvw.rootViewController?.present(ivc, animated: true, completion: nil)
}

It's working fine in Xcode 10.3, but when I run my code in Xcode 11.2.1,the popup is coming but it dismiss immediately after open.

I tried with

ivc.modalPresentationStyle = .fullScreen

But it's not working.

dahiya_boy
  • 7,885
  • 1
  • 25
  • 39
MeMouli
  • 43
  • 7
  • There are change in AppDelegate in iOS 13. Everything you do with window now behave same. In my case, `UIAlertViewController` behaving same then I changed the parent from window to UIViewController and it starts working properly. For you post, your can get answer from here -> https://stackoverflow.com/questions/57060606/uiwindow-not-showing-over-content-in-ios-13 – dahiya_boy Dec 04 '19 at 07:51
  • your code is perfect, just change the last line from your code. replace it with present(ivc, animated: true, completion: nil) – Bhawin Ranpura Dec 04 '19 at 13:19

1 Answers1

1

I have run this code on my xCode 11.2 and it runs successfully.

func annoucementdisplay()
{
    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let ivc = storyboard.instantiateViewController(withIdentifier: "PopUpViewController") as! PopUpViewController
    ivc.modalTransitionStyle = .crossDissolve
    ivc.modalPresentationStyle = .custom
    let quiclvw = UIWindow(frame: UIScreen.main.bounds)
    quiclvw.windowLevel = UIWindow.Level.alert
    quiclvw.rootViewController = UIViewController()
    quiclvw.makeKeyAndVisible()
    let transition = CATransition()
    transition.duration = 1.0
    transition.type = CATransitionType.reveal
    transition.subtype = CATransitionSubtype.fromBottom
    quiclvw.layer.add(transition, forKey: kCATransition)
    present(ivc, animated: true, completion: nil)
}