ViewController Appears to Transition Twice

我们两清 提交于 2019-12-03 21:12:56
Saeed Hajizade

I had ALMOST the same problem and my second VC was sliding twice. The problem was with that segue arrow in my Main.storyboard. I control-dragged from a button in first VC and not from my VC (that little yellow circle on top of every VC), so I deleted that segue arrow and control-dragged from VC yellow circle to my second VC and it fixed the problem.

Also this is how I used performSegue function:

@IBAction func toSignUp(_ sender: Any) {
    performSegue(withIdentifier: "signUp", sender: nil)
}

Hope this was helpful.

Dave G

Essentially you simply need to rename the destination view controller's class.

For full answer see this post:

View Controller Loads Twice - How Do I Fix It?

One reason might be that the controller which is being pushed have another transition in its viewWillAppear() method.

In my case, I had put textField.becomesFirstResponder() in viewWillAppear() method which triggers keyboard to show

Move any such method to viewDidAppear()

I found Elena's answer (on this thread Pushing View Controller Twice) to be a time saving quick fix by simply checking if the navigation controller already contains the ViewController you want to push to.

if !(self.navigationController!.viewControllers.contains(editView)){
self.navigationController?.pushViewController(editView, animated:true)

}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!