I am trying to transfer some data between my views in a tab bar. my first view is to load and manipulate data from my model class. But when I click the second or third tab in my tab bar controller, the data is not transferred. This is how I try to convey it.
-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
if (tabBarController.selectedIndex == 1){
HashTagTableViewController *hash [[HashTagTableViewController alloc]init];
hash.userArray = feed.userArray;
}else if (tabBarController.selectedIndex == 2){
PhotoTagTableViewController *photo = [[PhotoTagTableViewController alloc]init;
photo.userArray = feed.userArray;
}
}
feed is the name of the instance of my model class that I created in the current controller. I am trying to avoid creating multiple instances of the model class as it must make multiple API calls. All I am trying to do is pass on to feed.userArrayother views that need to be manipulated differently.
source
share