In the last line of this method, howcome [self navigationController] does not give runtime error? self is actually RootViewController and it does not have a property named navigationController? What am I missing here?
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Create the detail view lazily
if (detailViewController == nil) {
DetailViewController *aDetailViewController = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped];
self.detailViewController = aDetailViewController;
[aDetailViewController release];
}
// Set the detail controller's inspected item to the currently-selected item
SimpleDrillDownAppDelegate *appController = (SimpleDrillDownAppDelegate *)[[UIApplication sharedApplication] delegate];
detailViewController.detailItem = [appController objectInListAtIndex:indexPath.row];
[[self navigationController] pushViewController:detailViewController animated:YES];
}