Detailed table view not working after changing main view
I'm new to programming and I have the following problem.
I have a navigation based app that present开发者_运维问答s data from a SQLite data base in a table which can be drilled down to a detailed view. I have changed that main view of the app to present a login in view.
The login view works, the table presents the correct data and works fine however I can no longer get the detailed view to work. The app does not freeze or crash, there are no errors but it will not show the detailed view. Also the login view has a back button in the header which shows a view which was deleted. I think the problem lies in the following code but I'm unsure (maybe the appDelegate).
This code is from the RootViewController.
- (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 = (SQLAppDelegate *) [[UIApplication sharedApplication] delegate];
self.title = @"Back";
}
I think you have a structural issue. This is what I would do:
change the app so that it starts with a simple (Non-UINavigation) view. This is your logon view.
When that view has successfully authenticated the user, change the view to a navigation view (and controller) using removeFromSuperview and addSubView methods to remove the logon view and controller from the window and replace them with a navigational view and controller.
The basic idea is not to use a navigation based system until your user has logged in. Your description makes it sound like you are starting with a navigational view and then tryin to add a logon. It's easier the other way around.
精彩评论