Hi I added a prepare for segue code in order to transfer information, however I'm getting an error.
I have a tab bar controller. It has 4 tabs. Each tab has a navigation controller, and a VC as a root view controller.
from tab 1-->nav controller-->VC 1 I need to take a value to tab2-->nav controller --->VC1
(also is the segue connected to the nav controller at tab 2, or the root view at tab 2) Thank you in advance
error:customizableViewControllers]: unrecognized selector sent to instance 0xf19bd60 (but I am going to tab 2 (index 1))? where is my error?
if ([segue.identifier isEqualToString:@"ResultsSegue"])
{
//the root VC at tab 2
ResultsIndexViewController*controller=[[ResultsIndexViewController alloc]init];
UITabBarController *tabController = [segue destinationViewController];
controller = (ResultsIndexViewController*)[[tabController customizableViewControllers]objectAtIndex:1];//crashing here
controller.resultsArray=[NSMutableArray arrayWithArray:_matchedResultsArray];
}
}
tabbarcontroller
is not aUITabBarController
. Are sure, that[segue destinationViewController]
returns aUITabBarController
? Is that, how the segue is configured? – SAEcustomizableViewControllers
is a method for tabbarcontroller; nav controllers don't understand this. If it should be linked to a tabbar controller depends only on what you want to achieve. Nav controller is something completely different than a tab controller. Whatever; the code must reflect what is in your storyboard. Either both nav or both tabbar. – SAE