简体   繁体   English

弹出视图控制器在 Xcode 11.2.1 中打开后立即关闭

[英]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.

相关问题 WKWebView 操作表在被解散后解散呈现视图控制器 - WKWebView action sheet dismisses the presenting view controller after being dismissed UIDocumentMenuViewController取消呈现视图控制器 - UIDocumentMenuViewController dismisses presenting view controller dismissModalViewControllerAnimated也关闭调用它的视图控制器 - dismissModalViewControllerAnimated also dismisses the view controller that calls it 解除 UIImagePickerController 也解除呈现视图控制器 - Dismissing of UIImagePickerController dismisses presenting view controller also 触摸屏幕区域可关闭视图控制器 - Touching an area of screen dismisses view controller 按下后立即弹出视图控制器 - Popping view controller immediately after pushing it Xcode:如何创建出现在另一个视图控制器中的PopUp视图控制器 - Xcode: How To Create A PopUp View Controller That Appears In Another View Controller iOS-解雇其他View Controller后立即显示View Controller - iOS - Present View controller immediately after dismissing an other view controller 用户关闭视图后重新加载tableviewcontroller - Reload tableviewcontroller after user dismisses view MPMoviePlayerViewController立即关闭 - MPMoviePlayerViewController dismisses immediately
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM