Did you add TrekTabController.h
in the view controller implementations of the view controllers which are shown in the tabs? If so, try to add casting: [(TrekTabController*)self.tabBarController userIds]
.
How to access a tab controller's property from each of its tabs?
-
16-07-2023 - |
Question
I am currently passing the userId property to the tab controller, which wraps three tabs, but how do I access the userId in each of the view controllers?
I tried [self.tabBarController userIds]
but userIds does not work and errors...
Here is the tab controller .h file
#import <UIKit/UIKit.h>
@interface TrekTabController : UITabBarController {
NSString *userProfileId, *userProfileName;
}
@property (nonatomic, retain) NSString * userProfileId;
@property (nonatomic, retain) NSString * userProfileName;
@end
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow