prepareForSegue not called when UITableView row selected?

I have setup a UITableView using a NSFetchedResultsController that displays a number of prototype UITableViewCells. I have hooked up a push segue from my UITableViewCell to my DetailViewController.

In my TableViewController I have implemented both:

  • Does an int in Objective-C have a default value of 1?
  • Cocoa: Command /usr/bin/ditto failed with exit code 1
  • Compiling and linking Swift plus Objective C code from the OS X command-line
  • Method with multiple input parameters
  • Making a Button Call a Phone Number in iOS
  • Setting layoutMargins of UIView doesn't work
  • - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        NSLog(@"%s", __PRETTY_FUNCTION__);
        [tableView deselectRowAtIndexPath:indexPath animated:YES];
    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
        NSLog(@"%s", __PRETTY_FUNCTION__);

    When I run the application and click on a row in the tableView my application only calls:

    [TableViewController tableView:didSelectRowAtIndexPath:]
    [TableViewController tableView:didSelectRowAtIndexPath:]
    [TableViewController tableView:didSelectRowAtIndexPath:]

    If I delete the segue and rewire it form a UIBarButtonItem to the DetailViewController then the segue is called correctly, can anyone think what I am missing?



    - (IBAction)tester:(id)sender {
        [self performSegueWithIdentifier:@"SEGTEST" sender:nil];

    and connected it unto a UIButtonBarItem that called “tester” and it works, I just can’t get it to fire still when I link from the UITableViewCell to the controller.

    2 Solutions Collect From Internet About “prepareForSegue not called when UITableView row selected?”

    After a bit of digging I eventually found that the UITableViewCell identifier was set incorrectly to “CELL_ID” when it should have been “PLANTCELL_ID“.

    Som for anyone else who finds that selecting a UITableViewCell in a UITableView does not call the associated segue, check if your cell identifier is set correctly in both the storyboard and tableView:cellForRowAtIndexPath:.

    Rewire your segue from the ViewController itself and give it a name.
    Then in the didSelectRow method call

    [self performSegueWithIdentifier:@"yourSegueName"];    

    and see if it fires.