0
votes

Is there anyway to programatically control which viewController is pushed into view when a segue us selected? What I want to do is segue to one of two controllers when a UITableViewCell is tapped, one for iPhone4 (960 height) and the other iPhone5 (1136 height).

I could just layout/arrange a single view controller manually to accommodate the extra height. Or I could add a 2nd segue (with another ID) and then use -tableView:didSelectRowAtIndexPath: in conjunction with -performSegueWithIdentifier:sender: to push the correct viewController based on screen height.

1

1 Answers

0
votes

The original question related to a segue that is setup to automatically fire by dragging between a UITableViewCell and a UIViewController in Interface Builder. Using this method you can only access one UIViewController via the segues one-to-one relationship.

You can get round this (and do what I originally asked) by wiring the segue directly from the UIViewController that contains the UITableView (rather from the cell itself) and then using tableView:didSelectRowAtIndexPath: to get the selected cell and perform the required segue. Using this method you can setup as many segues as required, by giving each segue a unique identifier you can programatically control which gets called (and when) by using -performSegueWithIdentifier:sender: