I am learning iOS and I wrote a simple iPhone application using iOS 5. The application displays a UITableView populated with speaker names when I select one of the names that is supposed to be sent to the UIViewController and show details about that person (name, address etc.), so actually two ViewControllers have a UITableViewController and a UIViewController (both subclasses).
So, in MICSpeakersTableViewController: UITableViewController I have this:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { MICSpeakerDetailViewController *detailViewController = [[MICSpeakerDetailViewController alloc] initWithNibName:@"Detail" bundle:nil]; [detailViewController setSpeaker:[[self getSpeakers] objectAtIndex:indexPath.row]]; [self.navigationController pushViewController:detailViewController animated:YES]; }
which is called when I select it, and the loudspeaker fills (in that it does not match the nil and description).
Then I have this in the same implementation:
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSIndexPath *indexPath = [ self.tableView indexPathForCell:sender]; if ([segue.identifier isEqualToString:@"Detail"]) [segue.destinationViewController setSpeaker:[[self getSpeakers] objectAtIndex:indexPath.row]]; }
Which is also called, and the segue.identifier parameter is Detail, and the destinationViewController speaker is set correctly (non-zero, description matches). I'm not quite sure why I should install this again, since I install it in didSelectRowAtIndexPath, but I install it again and it seems harmless.
Finally, initWithNibName and self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil] are called in MICSpeakerDetailViewController; returns an instance.
However, segue never happens, and viewDidLoad is never called.
Most likely something small, but I can't figure it out ... any advice?
Edit: here is a screenshot of the storyboard showing segue and controllers:
