I have a UITableViewController with a push segue storyboard linking to the prototype cell in the detail page, with the usual old UIViewController. In a storyboard, a detailed ViewController has an identifier, and segue has an identifier that matches the part identifier, except that the first letter has lowercase letters. In addition, the ViewController part has a "custom class" ( AttractionDetailViewController) selected in the drop-down list of classes.
Does not work. The problem is what instantiateViewControllerWithIdentifier:@"AttractionDetailsreturns nil.
The corresponding code. First, a method prepareForSeguethat the debugger has not previously used.
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"attractionDetails"])
{
AttractionDetailViewController *attrDetailVC = [segue destinationViewController];
}
}
Instead, it goes into this method:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
AttractionDetailViewController *attrDetailVC = [self.storyboard instantiateViewControllerWithIdentifier:@"AttractionDetails"];
NSIndexPath *selIndexPath = [self.tableView indexPathForSelectedRow];
attrDetailVC.theAttraction = [attractions objectAtIndex:indexPath.row];
[self.navigationController pushViewController:attrDetailVC animated:YES];
}
instantiateViewControllerWithIdentifier nil, , . , alloc init , , .
, , . - ?