Swift 4目前视图控制器黑屏

时间:2018-06-12 10:07:10

标签: ios swift xcode uiviewcontroller

我正在展示另一个这样的视图控制器:

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)
}

问题是,有一个cc。新视图控制器出现之间延迟1秒,同时应用程序显示全黑屏幕。这是为什么?它看起来很丑陋

2 个答案:

答案 0 :(得分:2)

在移动到下一个视图控制器时将动画状态更改为false,这将消除延迟。仅因动画而发生延迟:true。 使用以下代码解决您的问题

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

希望这会对你有所帮助

答案 1 :(得分:0)

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

相关问题