简体   繁体   English

Swift 4当前视图控制器黑屏

[英]Swift 4 present view controller black screen

I'm presenting another view controller like this: 我提出了另一个这样的视图控制器:

func goToScreen(id : String) {
    let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
    let newViewController = storyBoard.instantiateViewController(withIdentifier: id)
    self.present(newViewController, animated: true, completion: nil)
}

The problem is, there is a cc. 问题是,有一个抄送。 1 second delay between the appearance of the new viewcontroller, and in the meantime the app shows an all black screen. 新的ViewController的外观之间出现1秒钟的延迟,与此同时,该应用程序显示全黑屏幕。 Why is that? 这是为什么? It looks really ugly 看起来真的很丑

change status of animation to false while move to next view controller this will remove the delay. 将动画的状态更改为false,同时移至下一个视图控制器,这将消除延迟。 Delay happening only because of animation: true. 延迟仅由于动画而发生:true。 Use below code to solve your issue 使用下面的代码来解决您的问题

self.present(newViewController, animated: false, completion: nil)

Hope this will help you 希望这个能对您有所帮助

我是从UITabBarController继承的,而不是从我推送到的屏幕继承的UIViewController

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM