I tried to use the below code to do the switch:
[self.tabBarController setSelectedIndex:1];
I notice when I put this in viewDidLoad … nothing happened. But when I put in separate method, for example, when a button is clicked, it works.
any body know why?
What are you trying to achieve? To manually set the tab being displayed I just set the tab bar’s
selectedIndex.