Same view controller loads twice

浪子不回头ぞ 提交于 2019-12-02 05:46:52

Probably, when two ViewControllers appear it's because you have:

  1. A segue on Storyboard which start directly from a Button
  2. IBAction attached to the button where you call a performSegue of the same Segue

To fix this problem, you need to create a Segue which start directly from ViewController. After you can use the IBAction and the performSegue

You have added a seague but also an IBAction. If the seague is defined well in InterfaceBuilder it will perform and call your method. The IBAction is the alternative way for connecting an Action to a button. If you use both, you have two actions.

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