I'm trying to navigate from a UIViewController to a UITableViewController with this action button. Obviously I'm doing something wrong so it's missing the UINavigationController linked to the UITableViewController in my storyboard. Or something like that. This code displays the TableView when I press the button, but navigation bar is missing so there's no way of going back and if I swipe through the tableview the app crashes.
-(IBAction)nextButtonPressed:(id)sender{
ResultsTableViewController *nextController = [[self storyboard] instantiateViewControllerWithIdentifier:@"Results Controller"];
nextController.objectsArray = resultObjectsArray;
[self presentModalViewController:nextController animated:YES];
[nextController release];
}
Should I link the UINavigationController with the UIViewController instead of the UITableViewController, will that work? Or should I target the code above for the UINavigationController instead? How to do this simple thing? Thanks.
EDIT 1:
Adding the Navigation Controller to the UIViewController instead and push to the TableView with it like this:
[self.navigationController presentModalViewController:nextController animated:YES]
didn't solve the issue. It still crashes when swiping.
EDIT 2:
If I do like this:
[self.navigationController pushViewController:nextController animated:YES]
it crashes once the tableview is visible on screen. I get a glance at the navigation bar with "back" button now though. This is crash report from this:
-[__NSCFType isViewLoaded]: unrecognized selector sent to instance. Rødvinsguiden[318:f803] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType isViewLoaded]: unrecognized selector sent to instance 0x6b9d2e0'