Setup a new iPhone window based project with a UITabBarController and connect everything up in IB. Using self.tabBarController.selectedIndex = 1; you should be able to switch tabs programmatically. But, it only seems to work in certain circumstances. If you tie it to an IBAction or as the result of the image picker it works great. But, if you call it too quickly it seems to only partially work. The tab gets selected at the view is still the old view.
I tried to put self.tabBarController.selectedIndex = 1; in a switch statement in the viewDidLoad as a method to return to the previously selected tab on launch and it won't work. I then added an NSTimer and tried to do it .01 seconds later and it works fine, so it's obviously a timing/ordering issue.
Any suggestions of when I should be clear to switch tabs?