Swift:在过渡到下一个View Controller期间将重新显示Current View Controller

时间:2018-11-13 16:10:42

标签: swift uiviewcontroller transition presentviewcontroller

当我使用ProfileController从View Controller A调用View Controller B(self.present(navControllerProfile, animated: false, completion: nil))时,在切换到B之前,再次快速显示View ControllerA。我使用相同的代码调用其他View Controller从View Controller A开始,过渡效果完美,只有向B的过渡才会出现此“错误”。有没有人想过类似的问题并设法解决呢?谢谢。

if self.view?.window == nil {
    self.window = UIWindow(frame: UIScreen.main.bounds)
}
self.view.window?.layer.add(self.transition, forKey: kCATransition)
if let profileInstantiated = self.storyboard!.instantiateViewController(withIdentifier: "ProfileController") as? ProfileController{
    let navControllerProfile = UINavigationController(rootViewController: profileInstantiated)
    //Transition with "bug" bellow
    self.present(navControllerProfile, animated:false, completion: nil)
}

1 个答案:

答案 0 :(得分:0)

经过几次测试并且无法发现问题的原因,我终于通过在以下链接中应用 HotJard 提出的解决方案来解决了该错误:How to present view controller from right to left in iOS using Swift