Question

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?

Was it helpful?

Solution

You can use

[self.tabBarController setSelectedIndex:tabIndex];

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top