Swift
Swift - TabBar 투명 문제
Goniii
2024. 10. 15. 18:47
문제 상황
- TabBar의 배경색을 white로 주었는데도 비치는 문제
해결 과정
- tabBar.isTranslucent 설정을 false로 해주면 된다
- isTranslucent : TabBar의 배경이 반투명한지 여부를 나타내는 불 값
// tabBarItem 설정
private func setTabBarItem(){
homeVC.tabBarItem = UITabBarItem(title: "HOME", image: UIImage(named: "tabBar_home"), tag: 0)
styleVC.tabBarItem = UITabBarItem(title: "STYLE", image: UIImage(named: "tabBar_style"), tag: 1)
shopVC.tabBarItem = UITabBarItem(title: "SHOP", image: UIImage(named: "tabBar_shop"), tag: 2)
savedVC.tabBarItem = UITabBarItem(title: "SAVED", image: UIImage(named: "tabBar_saved"), tag: 3)
let myTabBarImage = UIImage(named: "tabBar_my")?.withRenderingMode(.alwaysOriginal)
myVC.tabBarItem = UITabBarItem(title: "MY", image: myTabBarImage, tag: 4)
self.viewControllers = [homeVC, styleVC, shopVC, savedVC, myVC]
self.view.backgroundColor = .white
self.tabBar.isTranslucent = false
}
참고 자료
728x90