I have @property NSString *memberid;
in tabbarcontrller
.
I will use it in all of it's viewcontorllers
.
I want to update the memberid
by one of it's viewcontroller
. so that other view controller can use the new value.
How can I update the NSString
?
I am doing something like this in one of my project,
NSArray *tabArr = [self.tabBarController viewControllers];
UINavigationController *navController1 = [tabArr objectAtIndex:1];
DraftViewController *dvc = [navController1.viewControllers firstObject];
dvc.screenTitle = self.screenTitle;
UINavigationController *navController3 = [tabArr objectAtIndex:3];
SentViewController *svc = [navController3.viewControllers firstObject];
svc.screenTitle = self.screenTitle;
UINavigationController *navController2 = [tabArr objectAtIndex:2];
OutboxViewController *ovc = [navController2.viewControllers firstObject];
ovc.screenTitle = self.screenTitle;
I am doing that in my first tab (first viewcontroller of tabbarcontroller)
I have embed navigationcontroller
to every viewcontroller (tabs). So, i get first nav controller and then get VC(tab).
If you don't have nav controller embed to your tab VC then [tabArr objectAtIndex:index]
returns view controller directly.