I am creating a storyboard that will pass through an unknown depth. What I am doing is creating a loop segue from the UITableViewCell to its main view controller. and in perforSegueWithIdentifier, I am passing the info for the next level.
That all works fine, but the problem is if I want to branch off to a detail view based on that data. I have to resort to hacks with buttons and phantom view segues. Does anyone know how this should be done officially? I want to be able to link the UITableViewCell to two different controllers and then decide which one to go to in performSegueWithIdentifier. is this possible?
I don’t have much experience with storyboards, but from what I know of traditional UITableView usage the cell should not be telling the view controllers what to be doing. Doing this breaks the MVC paradigm. The cell’s table view’s delegate (which is normally the view controller displaying the table view) will respond to the method
tableView:didSelectRowAtIndexPath:and will then perform the appropriate segue to the next view controller.For showing detailed views, table view cells offer the accessory type
UITableViewCellAccessoryDetailDisclosureButton. When using this type, the table view delegate can respond to the selectortableView:accessoryButtonTappedForRowWithIndexPath:and then perform the necessary segue to show the detailed view.I hope that makes sense.