I need to open programatically a certain tab in my tab bar.
I tried calling the following method from my UITabBarController:
self.selectedViewController = myVController;
Which doesn’t work.
What is the right way to open a tab?
Thank you.
Update: I tried the following code:
self.selectedViewController = [ [self viewControllers] objectAtIndex: 0];
which opens me a desirable tab(it is being selected), but the active view is not being updated.
Regarding the
selectedIndexproperty, Apple’s docs say:Perhaps this was your problem?
One possible workaround is to use your own
UITabBarand handle your own views. Then you can do something like this:Just implement
UITabBarDelegateand define this function to get item selection messages and manually switch views. (Although if you are using advancedUITabBarControllerfeatures it may not be worth your effort.)