ios - 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. Why is that? It looks really ugly
解决方案
在移动到下一个视图控制器时将动画状态更改为 false,这将消除延迟。延迟仅因动画而发生:是的。使用以下代码解决您的问题
self.present(newViewController, animated: false, completion: nil)
希望对你有帮助
推荐阅读
- sql-server - SQL Server 中归档表的正确查询
- json - 当我使用 ngx-translate 时如何解决这个错误?
- scala - Spray-json 和缺少定义的 json writer
- java - AEM - I/O 异常连接被拒绝
- javascript - 在节点请求中访问函数内部变量
- visual-studio-2015 - 使用 ORCA 工具将 MSI 设置为中文
- android - iOS 上的 CSS 与 Android 上的不同?
- java - Spring initializr 项目不适用于多个错误
- c# - 在哪里存储可以作为控制台应用程序或服务运行的应用程序的配置文件
- java - 如何在不更改代码且仅更改数据库的情况下在应用程序中进行功能更改?