How can I modify the title and the icon of items of TabBarController? It is possible directly in Interface Builder?
backgroundColor = UIColor(red:1, green:0, blue:0, alpha:1) / UITabBar. appearance(). tintColor = UIColor(red: 1, green: 0, blue: 0, alpha: 1) // New!! func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {...}
To change the text color for selected state, inside the TabBar widget, add the labelColor property and set the color. To change the text color for the unselected state, add the unselectedLabelColor parameter and change it colors.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With