![](/img/trans.png)
[英]WKWebView action sheet dismisses the presenting view controller after being dismissed
[英]popup view controller dismisses immediately after open in Xcode 11.2.1
通過使用以下方法調用彈出窗口
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)
}
它在 Xcode 10.3 中運行良好,但是當我在 Xcode 11.2.1 中運行我的代碼時,彈出窗口即將出現,但在打開后立即關閉。
我試過
ivc.modalPresentationStyle = .fullScreen
但它不起作用。
我已經在我的 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.