iOS segue executed twice

后端 未结 4 853
面向向阳花
面向向阳花 2021-02-06 00:18

I have a table view with different types of table view cells in it. In one of the cells, there are two buttons, which load a view controller when pressed. I am using the followi

相关标签:
4条回答
  • 2021-02-06 00:45

    Answer by can poyrazoğlu:

    are you sure you've wired up the actions correctly in interface builder? maybe you've wired the event for, say, both touch up inside and touch down inside instead of just touch up inside. or maybe you've also assigned the segue from both code and again in interface builder. have you checked them? it's a common mistake. –

    I was assigning the touch up inside actions for each button both the storyboard and my tableview's datasource methods.

    Thank you for your quick help can poyrazoğlu!!

    0 讨论(0)
  • 2021-02-06 00:47

    I always get this issue when I have my buttons directly wired up to the destination view controller. You need to make sure that you first delete the old segue you made, then click on the present view controller (where you are coming from) and CTRL + click to destination controller.

    This should fix it :)

    0 讨论(0)
  • 2021-02-06 01:01

    Maybe you want to wire up your segues with View Controllers instead of UIButtons!

    You should probably have the segues wired with some button like this: enter image description here

    But you should wire them with the view controllers instead: enter image description here

    0 讨论(0)
  • 2021-02-06 01:01

    For Swift 3, xcode, and ios 9+, which is what I am using: Make sure you are drawing segue from your UIViewControllers and not buttons or other interfaces.

    I had the same problem, and simply changing the start of the segue from the UIController instead of the button removed this bug.

    0 讨论(0)
提交回复
热议问题