[英]popup view controller dismisses immediately after open in Xcode 11.2.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.它在 Xcode 10.3 中运行良好,但是当我在 Xcode 11.2.1 中运行我的代码时,弹出窗口即将出现,但在打开后立即关闭。
I tried with我试过
ivc.modalPresentationStyle = .fullScreen
But it's not working.但它不起作用。
I have run this code on my xCode 11.2 and it runs successfully.我已经在我的 xCode 11.2 上运行了这段代码,它运行成功。
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)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.