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:
Result:
Related Topics
Add Assets to an Icloud Shared Photo Album Programmatically
Is There an Object Class in Swift
How to Use Enumerated in a List of Structs in Foreach Swiftui
Could Not Find an Overload for '-' That Accepts The Supplied Arguments
Swift: How to Continuously Send an Action from a Nstextfield
Tapping Is Required Twice to Uncheck Table Cell
Swift 4, Simultaneous Access to Tuple Members as Inout
Swift Generics and Protocol Extensions
Populating Collection View from Array in Document Directory
A Warning "'Init()' Is Deprecated". [Swift, iOS App, Learning Model]
Sklabelnode Text with Two Different Fonts and Colour. How Is This Possible
Return Object for a Method Inside Completion Block
Use Tableviewcontroller Inside Skscene
Qlpreviewcontroller Showing File Then Going Blank in Swiftui