Objective c 从it访问通用UITabBarController属性';什么标签?
我会描述我想做什么。 我有一个登录页面(ViewController) 登录后,我将传递到uitabarcontroller-MainTabBar.m。 此主选项卡栏具有“key”属性,该属性从登录页面获取用户密钥 UITabBarController有两个选项卡-Tab1.m和Tab2.m 我想从每个选项卡访问MainTabBar属性 我是怎么做到的Objective c 从it访问通用UITabBarController属性';什么标签?,objective-c,xcode,sdk,Objective C,Xcode,Sdk,我会描述我想做什么。 我有一个登录页面(ViewController) 登录后,我将传递到uitabarcontroller-MainTabBar.m。 此主选项卡栏具有“key”属性,该属性从登录页面获取用户密钥 UITabBarController有两个选项卡-Tab1.m和Tab2.m 我想从每个选项卡访问MainTabBar属性 我是怎么做到的 谢谢 假设Tab1和Tab2是UIViewController子类,您可以通过以下方式访问Tab1.m或Tab2.m中的key属性: #impo
谢谢 假设Tab1和Tab2是UIViewController子类,您可以通过以下方式访问Tab1.m或Tab2.m中的key属性:
#import MainTabBar.h
//...//
// Getting the parent TabBarController
MainTabBar *parentTabBarController = (MainTabBar *)self.tabBarController;
// Getting the key property from the parent TabBarController
NSString *theUserKey = parentTabBarController.key;
希望有帮助