Tab Bar Item Icons Appear Darker

UITabBar bar item icons are gray by default?

In my first view controller's viewDidLoad, I placed the following and it worked like a charm:

    let aTabArray: [UITabBarItem] = (self.tabBarController?.tabBar.items)!

for item in aTabArray {
item.image = item.image?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
item.imageInsets = UIEdgeInsetsMake(7, 0, -7, 0)
}

How do you change the color of unselected items in a Tab Bar?

Make the icon images Black, if they are white Im not sure it will work. As in the actual image themselves should be black in the assets folder not white.

If you add a tabbar from the story board you can put these line of code in that method in the appDelegate method shown in your post

UITabBar.appearance().barTintColor = UIColor.black
UITabBar.appearance().tintColor = UIColor.red
UITabBar.appearance().unselectedItemTintColor = .white

UITabBarItem icon not colored correctly for iOS 13 when a bar tint color is specified in Interface Builder in Xcode 11, beta 2

On the surface, this might seem like a bug, however you can mitigate it by defining an .unselectedItemTintColor on your UITabBar instance.

self.tabBar.unselectedItemTintColor = [UIColor lightGrayColor];

Dark box instead of custom tabBar item

If you just want an empty tabBar without any function or action, then just set the Title and Image in the Attributes inspector of this Tab Bar Item empty. Everytime you delete an existing title or image value confirm with hitting Enter/Return. The last part is to uncheck the Enabled checkbox, so hitting the empty space has no effects.

See the screenshot:

Sample Image

Result:

Sample Image



Related Topics



Leave a reply



Submit