views:

400

answers:

1

Hello, I have implemented a method didSelectRowAtIndexPath that should push another view. I have a code running properly using a navigationController but in this case I am using a navigationItem on a view. How could I trigger a view? Thanx

Error log:

2010-03-25 00:09:52.459 TableArchive[1062:207] trigger
2010-03-25 00:09:52.461 TableArchive[1062:207] *** -[UINavigationItem pushViewController:animated:]: unrecognized selector sent to instance 0x3921ca0
2010-03-25 00:09:52.462 TableArchive[1062:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UINavigationItem pushViewController:animated:]: unrecognized selector sent to instance 0x3921ca0'
2010-03-25 00:09:52.463 TableArchive[1062:207] Stack: (


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
 NSLog(@"trigger");

 if(dvController == nil) {
   DetailView *aController =[[DetailView alloc]initWithNibName:@"DetailView" bundle:nil];

   self.dvController = aController;

   [aController release];
 }

 [[self navItem]pushViewController:dvController animated:YES];

 [dvController release];
}
A: 

Obviously you can't do [[self navItem]pushViewController:dvController animated:YES]; because a UINavigationItem isn't a UINavigationController.

You have to use [[self navigationController] pushViewController:dvController animated:YES]; instead. Beyond that, I don't get what you're asking.

Dave DeLong