I have two viewcontrollers that are both bundled with navigationcontrollers. Im trying to send an object from one viewcontroller to the other. I use the code below in the didselectrow of the table:
UIViewController *serviceTable = [self.storyboard instantiateViewControllerWithIdentifier:@"navigationServiceNews"];
((TableServiceNews*)serviceTable).service_ID = [ServiceID objectAtIndex:indexPath.row];
[self.slidingViewController anchorTopViewOffScreenTo:ECRight
animations:nil onComplete:^{
CGRect frame = self.slidingViewController.topViewController.view.frame;
self.slidingViewController.topViewController = serviceTable;
self.slidingViewController.topViewController.view.frame = frame;
[self.slidingViewController resetTopView];
}];
The identifier that im using (navigationServiceNews) points to the navigationcontroller that is bundled with the destination viewcontroller.
While using this identifier, the app crashes because obviously instantiateViewControllerWithIdentifier returns a veiwcontroller not a navigationcontroller.
When i change the identifier to the ID of the destination viewcontroller,every works fine but i lose the navigationBar on the header which is very important to my project(it is the reason i decided to bundle the viewcontrollers with navigationcontroller).