Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone change tab bar item on button click

I have 4 tabs in my iphone application. When user will click a button in tab-1, I want to move/switch user to another tab suppose tab-2.

How to do that?

like image 462
Ruchir Shah Avatar asked Mar 25 '10 17:03

Ruchir Shah


2 Answers

You can use

[self.tabBarController setSelectedIndex:tabIndex];

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

like image 191
Jasarien Avatar answered Nov 01 '22 22:11

Jasarien


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

like image 29
Darkin Avatar answered Nov 01 '22 20:11

Darkin