Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 从it访问通用UITabBarController属性';什么标签?_Objective C_Xcode_Sdk - Fatal编程技术网

Objective c 从it访问通用UITabBarController属性';什么标签?

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

我会描述我想做什么。 我有一个登录页面(ViewController)

登录后,我将传递到uitabarcontroller-MainTabBar.m。 此主选项卡栏具有“key”属性,该属性从登录页面获取用户密钥

UITabBarController有两个选项卡-Tab1.m和Tab2.m

我想从每个选项卡访问MainTabBar属性

我是怎么做到的


谢谢

假设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;
希望有帮助