Reputation: 303
I've used UITabbar. I've set it's background color to clear color. Even though the black colored background is appearing. I debugged the view and found that the UITabbar has implemented UIVisualEffectSubView and UIVisualEffectBackdropView to black color implicitly. What could be the better way to make it transparent with swift 4. Image of debug is attached below.
Upvotes: 1
Views: 1605
Reputation: 1616
Try this:
yourTabBar.backgroundColor = UIColor.clear // clears the background
yourTabBar.backgroundImage = UIImage()
yourTabBar.shadowImage = UIImage() // removes the border
iOS 15 UPDATE
For Coloured background
if #available(iOS 15.0, *) {
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = .YourColor
tabBar.standardAppearance = appearance
tabBar.scrollEdgeAppearance = appearance
}
For Transparent Appearance
if #available(iOS 15.0, *) {
let appearance = UITabBarAppearance()
appearance.configureWithTransparentBackground()
tabBar.standardAppearance = appearance
tabBar.scrollEdgeAppearance = appearance
}
Upvotes: 3
Reputation: 3526
You need to use the barTintColor on your tabBar
tabBar.backgroundColor = UIColor.clear
tabBar.barTintColor = UIColor.clear
tabBar.backgroundImage = UIImage()
Upvotes: 0