Reputation: 9965
In my storyboard I have a view controller (Call it "source") that push-segues to another view controller (let's say "destination").
The push can be triggered from one of three places:
What I currently have is segues that I ctrl+dragged from each of these views to the destination VC, and gave all of them the same identifier (since they all push the same VC...) This works flawlessly, except this annoying little thing that shows up every time I hit cmd+R:
Well, I tried to be a good citizen and anchor all my vies to an IBAction
in the source VC where I call performSegueWithIdentifier:
but I can't do it to the cell and the cel inside the election view... Only to the button in my header view...
I really don't want to have a code in my collection view custom class that call to the action method of the source view controller AND more code in didSelectCell...
to check if it's the right cell prototype and than call the action method.... all this feels way worst than having 3 segues with the same id - which (in my opinion) really makes sense in my case - and also works perfect...
Just to make it clear - this is how it currently looks:
Any ideas?
Upvotes: 0
Views: 152
Reputation: 119242
You can stick with your three segues pattern, but give each one a separate but related identifier, like PushDetailButton
, PushDetailCell
and so on.
In prepareForSegue
, you can use hasPrefix:@"PushDetail"
instead of isEqual
to match any segue whose identifier starts with the string, instead of matching the whole string.
Upvotes: 1