I’m a newbie to programing and I have a view based app that collects data from a SQLite database and show it in a table. That much I have got working however I can’t get the app to show a detailed view once an item on the table is selected. Here is my code if anyone can help.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (dvController == nil)
dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle: nil];
Clubs *clubObj = [appDelegate.clubArray objectAtIndex:indexPath.row];
[clubObj hydrateDetailViewData];
dvController.clubObj = clubObj;
[self.navigationController pushViewController:dvController animated:YES];
}
-(void)viewDidLoad {
[super viewDidLoad];
appDelegate = (ClubFindAppDelegate *) [[UIApplication sharedApplication] delegate];
self.title = @"Back";
}
Any help would be appreiciated.
Thanks
If you started with a view based app, perhaps your view controller doesn’t have a
self.navigationControllerinstance available. Your view controller must be within a navigation controllers stack to push further view controllers.To turn a view based app into one with a navigation controller all you really have to do is edit the app delegate as follows:
becomes
You might also want to save the navigationController as a property of the application delegate also.