本文介绍了使用 selectedViewController 属性以编程方式切换选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用过搜索,还没有找到答案.

I've used search already, haven't found an answer.

尝试像这样切换:

[self. tabBarController.selectedViewController OptionsViewContorller];

像这样:

 [self.tabBarController.selectedViewController = self.tabBarController.viewControllers     objectAtIndex:3];

但它不起作用,我也尝试过并建议更改

but it doesn't work, i also tried and advice to change

self.tabBarController.selectedIndex

但它只在标签栏而不是视图中改变.

but it only changes at tab bar not a view.

推荐答案

这应该有效.

self.tabBarController.selectedViewController = [self.tabBarController.viewControllers objectAtIndex:3];

这篇关于使用 selectedViewController 属性以编程方式切换选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-30 08:18