Perhaps I am missing something simple. I added a modal segue from a button to a view controller. I then added some steps to prepareForSegue (and checked I had named the segue correctly). I have done this a few other times with no problem.
Now, when I click the button, the modal window opens, but the prepareForSegue does not fire. I tried putting a log statement in the prepareForSegue before it even checks the description of the label (so theoretically it should fire for any segue). But I get nothing logged.
Any ideas?
Best Answer
Connecting a segue from a button to the next controller is the correct way to connect it, just remember that
prepareForSegue:
is called on the VC that owns the button not the incoming controller. You get the incoming controller by calling[segue destinationViewController]
.