ios - 使用选定的 ViewController 属性以编程方式切换选项卡

标签 ios uitabbarcontroller

我已经用过搜索了,还没有找到答案。

尝试像这样切换:

[self. tabBarController.selectedViewController OptionsViewContorller];

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

但它不起作用,我也尝试过并建议改变
self.tabBarController.selectedIndex

但它只在标签栏而不是 View 中更改。

最佳答案

这应该有效。

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

关于ios - 使用选定的 ViewController 属性以编程方式切换选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9633420/

相关文章:

ios - 将数据从一个 Collection View 传递到嵌入式 Collection View

iphone - 仅以编程方式为不在 AppDelegate 中的一个 ViewController 创建 TabBar

swift - 按 T​​abBar 项目后弹出

ios - 在 iOS6 中使用 Storyboard 子类化 UITabBarController

ios - 从以编程方式创建的导航栏项设置操作

ios - 更改未选择的标签栏项目的颜色

python - Opencv iOS安装

IOS 应用程序无法通过 socket.io(SIOSocket) 连接到 sails.js 服务器

html - 在 PhoneGap 中将 Jquery 中的值从一个 html 类传递到另一个 html 类

ios - 即使用户重新安装后也限制 iOS 应用程序