以编程方式切换到TabBar选项卡视图? [英] Switching to a TabBar tab view programmatically?

查看:88
本文介绍了以编程方式切换到TabBar选项卡视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我的iPhone应用程序在一个标签页视图中有一个 UIButton ,我想让它在<$ c的标签栏中打开另一个标签页$ C> TabBarController 。我该如何编写代码来执行此操作?

Let's say I have a UIButton in one tab view in my iPhone app, and I want to have it open a different tab in the tab bar of the TabBarController. How would I write the code to do this?

我假设我卸载现有视图并加载特定的标签视图,但我不确定如何准确编写代码。

I'm assuming I unload the existing view and load a specific tab view, but I'm not sure how to write the code exactly.

推荐答案

试试这个:

self.tabBarController.selectedIndex = 1;

[self.tabBarController setSelectedIndex:1];

这篇关于以编程方式切换到TabBar选项卡视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆