Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i navigate to another tab bar item by a button click in first tab?

Tags:

ios

I have a situation to navigate from first tab item to second tab item by a button click in first tab. how can i do that ?

like image 413
Gowtham Avatar asked Dec 10 '25 21:12

Gowtham


1 Answers

You can call -setSelectedIndex: in your button click handler. This would select the 3rd tab.

[tabBarController setSelectedIndex: 2];

Please note that documentation is your friend: UITabBarController Class Reference

In addition you can try this:

[tabBarController setSelectedViewController:(UIViewController *)[tabBarController.viewControllers objectAtIndex: 2]];
like image 128
Rok Jarc Avatar answered Dec 12 '25 13:12

Rok Jarc