开发者

iphone change tab bar item on button click

I have 4 tabs in my iphone application. W开发者_JS百科hen user will click a button in tab-1, I want to move/switch user to another tab suppose tab-2.

How to do that?


You can use

[self.tabBarController setSelectedIndex:tabIndex];

where tabIndex is the index of the tab you want to switch to.


Might also point out that if you are inside a view, you should use super instead of self.


Swift 3.0 version of @Jasarien answer:

self.tabBarController?.selectedIndex = tabIndex

where tabIndex is the index of the tab you want to switch to.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜