UITabBarController tabs and headers are not set until I touch them
I have set properties title
, image
and selected-image
each of my UIViewControllers in their method viewDidLoad:
. These view controllers are in the UITabBarController, and according to the documentation provided, if you set these three properties, the UITabBarController will automatically display them.
[self setTitle: @"title"];
[self.tabBarItem setImage: [UIImage imageNamed:@"image.png"]];
[self.tabBarItem setSelectedImage:[UIImage imageNamed:@"image-selected.png"]];
But the problem is that View controllers are not created until the user deletes the corresponding tab in the UITabBar, so no images or title are displayed until the tabs are clicked.
Is there a clean and OOP way to make the UITabBarController update and pull data from their view controllers? What's the point of having properties title
, image
and selected-image
if you need to manually specify which UITabBarController is?
source to share