开发者

How to programmatically call UITabbar from a tab/subview/subclass?

开发者 https://www.devze.com 2023-04-12 23:30 出处:网络
I have created a Tabbar Application using Xcode. I have 5 differe开发者_JS百科nt tabs and I want to select tab 1 from tab 3 so that tab 1 gets highlighted in the same way for the other tabs.

I have created a Tabbar Application using Xcode.

I have 5 differe开发者_JS百科nt tabs and I want to select tab 1 from tab 3 so that tab 1 gets highlighted in the same way for the other tabs.

Is there a way to do this? If so is there any example code?


Tab indexes start at 0. so index 0 would be the first tab, index 1 would be the second tab etc.

So this is an example IBAction that will work (I just tested it) and send you to the second tab.

- (void)sendSecondTab:(id)sender
{
    self.tabBarController.selectedIndex = 1;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消