views:

127

answers:

1

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

A: 

Ok so as I said I was missing something simple the fix was to remove the .xib from the nib name.

//change line SecondViewController *detailViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController.xib" bundle:nil];
//to
 SecondViewController *detailViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];