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?
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]
.
Well I found the rookie error I suspected. I duplicated a VC and forgot to set it's class to my new VC class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With