Question

How can I modify the title and the icon of items of TabBarController? It is possible directly in Interface Builder?

Was it helpful?

Solution

in code:

UITabBarItem *tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Fancy Tab" image:[UIImage imageNamed:@"FancyTab"] tag:1];
myViewController.tabBarItem = tabBarItem; // to set the tabBarItem from outside the viewController
self.tabBarItem = tabBarItem;             // to set the tabBarItem from inside the viewController

in regular .xib: click the item in the tabBarController. And then click it again. You can now edit title and icon in the attribute inspector.

in storyboard: click the item in the viewController that is connected to the tabBarController (not in the tabBarController itself). This time one click is enough. And set title and icon in the attribute inspector.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top