prepareForSegue called before didSelectRowAtIndexPath only when third segue is added prepareForSegue called before didSelectRowAtIndexPath only when third segue is added ios ios

prepareForSegue called before didSelectRowAtIndexPath only when third segue is added


You should use either didSelectRowAtIndexPath or segues from cell, but not both. If you want your didSelectRowAtIndexPath to invoke segues, those segues should not be from the cell to the next scene, but rather from the view controller icon in the bar above the scene:

segue between view controllers

You can now select this new segue, go to the "attributes inspector" (option+command+4), and supply a storyboard identifier which you can reference in your code when you call performSegueWithIdentifier.


The reason is you can't drag from a tableview cell to multiple views. As @rdelmar mentioned this is wrong. You should drag from the destination to the source view and then handle manually the way I did above.

Also can be found here: Conditional segue performed on tap on UITableViewCell