I'm attempting to add view controllers to my tabbarcontroller, and then make the first one the selected one using the following code:
[self setViewControllers:[NSArray arrayWithObjects:self.detailController,self.mapController,nil] animated:NO];
[self setSelectedIndex:0];
When this code is called, the correct view controllers/tabs are added, but none are selected. Is there a better way to do this?
Update: To add more context, the above code snippet is being called in the viewDidLoad method of a viewcontroller that subclasses UITabBarController.