5

Is there a way to connect a prototype cell to different scenes and on the didSelectRowAtIndexPath method call the [self performSegueWithIdentifier:@"NAMEOFTHESEGUE" sender:self] ? I can't seem to drag multiple segues from the prototype cell to different scenes... I know it is possible with static cells because you can draw a segue from each cell to the scene but what if i'm using prototype cells?

I'm currently trying to implement this using the SWRevealViewController (https://github.com/John-Lluch/SWRevealViewController) plugin. In the storyboard example project he's using a table with 3 static cells and connecting each cell to a different scene. But in my case static cells are not an option so if anyone knows the answer that would be great.

Oh and also embedding the "side panel view controller" which is a UIViewController inside a navigation controller so i can connect the navigation controller to different scenes is not an option because in that case the new scene opens inside the slide panel ...

Please take into consideration that i'm still a rookie in IOS programming. Appreciate your time!

EDIT + solution : I had tried connecting the segues from the view controller to the scenes but it kept giving and exception "NSInvalidArgumentException - receiver has no segue with identifier..." The solution was in Xcode to go to "Product" then choose "Clean" : https://stackoverflow.com/a/14089463/1185133

Community
  • 1
  • 1
cenob8
  • 624
  • 2
  • 7
  • 16

2 Answers2

11

Yes, the only thing is that you don't have to connect your prototype cell to multiple destinations, the origin of the multiple segue must be the view controller:

1 - create the segue from your Table View Controller (not the cell) to the destination VC and give to each segue an unique name.

2 - override didSelectRowAtIndexPath: and call [self performSegueWithIdentifier:@"NAMEOFTHESEGUE" sender:self]

That's all :-)

LombaX
  • 17,265
  • 5
  • 52
  • 77
  • I had tried that several times but it kept giving me an error : NSInvalidArgumentException - receiver has no segue with identifier ... Decided to Google that error and came upon the solution : In the menu go to Product and then choose "Clean". Don't ask me why or how, but that fixed the problem... See : http://stackoverflow.com/a/14089463/1185133 – cenob8 Jun 24 '13 at 17:38
0

If you have you have put a table view within a View Controller, drag the segues from the Controller and not the cell, just as LombaX has explained above

Fred
  • 332
  • 4
  • 5