Reputation: 117
I don't know how to change the background of the TabBar by an Image (I try to change the background of TabBar, not try to change the TabBar Icon by an Image)
I tried to set an background to my TabBar such as the TabBar of the program on the right
Upvotes: 3
Views: 646
Reputation: 258345
Assuming you have right image in your assets catalog (or prepared in advance), you can set it in view's init, like
struct ContentView: View {
init() {
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundImage = UIImage(named: "image")
UITabBar.appearance().scrollEdgeAppearance = appearance
}
// ... other code
}
Upvotes: 5