How do I push another viewController onto the navigationController from within a tabviewController?

Posted by user207788 on Stack Overflow See other posts from Stack Overflow or by user207788
Published on 2010-05-12T17:51:03Z Indexed on 2010/05/12 17:54 UTC
Read the original article Hit count: 248

Hi,

I have a project set up using these two tutorials.

http://twilloapp.blogspot.com/2009/03/how-to-embed-navigation-controller.html

and

the link for the second tutorial is at the bottom of the first.

The tutorial is slightly outdated but I managed to get it to work as advertised.

Now I want to push a new detailedView onto the NavigationController when a user touches a row in the table view.

So I added this to my MyTableViewController.m file.

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic may go here. Create and push another view controller.

     SecondViewController *detailViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController.xib" bundle:nil];
     // ...
     // Pass the selected object to the new view controller.

     [self.navigationController pushViewController:detailViewController animated:YES];
     [detailViewController release];

}

Now when I run this project and touch a row in my table view I am getting an error:

asm_Terminating_due_to_uncaught_exception

IT seems to be having an issue loading the SecondViewController from nib, however I checked the detailViewController and it is not nil.

I know I am missing something and it is more than likely something simple.

Please help.

Thanks, Bruce

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about uinavigationbar