-2

如何从应用程序全局访问标签栏视图控制器?标签栏视图控制器在故事板中设置。我不想创建一个新的,但要获得现有的。

4

1 回答 1

0

我猜它UITabBarViewController被设置为应用程序的窗口rootviewController。如果是这种情况,您可以像这样得到它:

AppDelegate *myAppDelegate = (AppDelegate *)[ [UIApplication sharedApplication] delegate];
UITabBarViewController *myTabBarViewController = (UITabBarViewController *) myAppDelegate.window.rootViewController;

AppDelegate您的 App Delegate 类的名称在哪里。

希望这可以帮助。

问候,

乔治

于 2012-09-11T12:35:49.950 回答