Cocoa touch 引用Cocoa中的父项
我的问题是如何从一个ViewController中访问TabBarController 假设有一个mainClass.m添加了tabBarController,它有两个ViewController—viewController1和viewController2 在viewController1.m中有一个游戏。游戏结束后,viewController1.m希望告诉tabBarController显示viewController2,但viewController1没有对tabBarController的引用。如何引用viewController的父级Cocoa touch 引用Cocoa中的父项,cocoa-touch,controller,uitabbarcontroller,parent-child,Cocoa Touch,Controller,Uitabbarcontroller,Parent Child,我的问题是如何从一个ViewController中访问TabBarController 假设有一个mainClass.m添加了tabBarController,它有两个ViewController—viewController1和viewController2 在viewController1.m中有一个游戏。游戏结束后,viewController1.m希望告诉tabBarController显示viewController2,但viewController1没有对tabBarControll
如何从当前视图的代码中更改tabBarItems?通过视图控制器的tabBarController属性
[ self.tabBarController setViewControllers: viewController2 animated: YES ];
其中“self”是viewController1
此外,从技术上讲,tabBarController不是任何视图控制器的父级。这样说会混淆继承在Objective-C中的工作方式。视图控制器的超类或父类是UIViewController。通过视图控制器的tabBarController属性
[ self.tabBarController setViewControllers: viewController2 animated: YES ];
其中“self”是viewController1
此外,从技术上讲,tabBarController不是任何视图控制器的父级。这样说会混淆继承在Objective-C中的工作方式。视图控制器的超类或父类是UIViewController。谢谢。这是内置在viewController中的非常棒的功能。如果它对您有效,请不要忘记选择我作为答案:你明白了。我不知道亲子关系是怎么回事,谢谢。这是内置在viewController中的非常棒的功能。如果它对您有效,请不要忘记选择我作为答案:你明白了。我不确定亲子关系是怎么回事。
[ self.tabBarController setViewControllers: viewController2 animated: YES ];