I am actually trying to display a new controller of type UIViewController MKMapViewDelegate
in the function didSelectRowAtIndexPath.
I have a tableview in a controller and when I click on a cell of this tableview i want to display the new controller of type UIViewController MKMapViewDelegate.
My code is the following:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
UIViewController *mapviewtest=[[MapStation alloc]initWithNibName:@"MapStation" bundle:nil];
[self.navigationController pushViewController:mapviewtest animated:YES];
//Station *station = nil;
//station = [self.listStation objectAtIndex:indexPath.row];
}
The problem is when i click on any cell of the tableview the program quit with a breakpoint on the line:
UIViewController *mapviewtest=[[MapStation alloc]initWithNibName:@"MapStation" bundle:nil];
I don’t know why it does that and how to resolve this mistake. Maybe do you know an other way to do it(without using pushviewController function).
Waiting for your answers guys 😉
Sincerely
Quentin
It sounds like you need to change the way you set up the application a little. Follow the design below and you should be fine. Your major problem sounds like you are not creating a navigation controller which you must do.
Inside the App Delegate:
Inside the RootViewController: