class MainTabBarViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemIndigo
...
let appearance = UITabBarAppearance()
appearance.configureWithDefaultBackground()
// Set the tab bar background to transparent
appearance.backgroundColor = .clear
// Optionally, you can add a blur effect for a nice see-through effect
appearance.backgroundEffect = UIBlurEffect(style: .light)
tabBar.standardAppearance = appearance
tabBar.scrollEdgeAppearance = tabBar.standardAppearance
setViewControllers([todayVC, movieVC, tvVC, searchVC], animated: true)
}
}
- appearance.backgroundColor = .clear: 탭바의 배경을 투명하게 설정합니다.
- appearance.backgroundEffect = UIBlurEffect(style: .light): 배경에 흐림 효과를 추가하여, 탭바 뒤에 있는 systemIndigo 색을 부드럽게 볼 수 있게 합니다. 이 효과는 선택 사항이지만, 배경을 투명하게 만들고 싶을 때 유용합니다.
[UIKit] UIVisualEffect - UIView에 흐림(Blur) 효과 주기
지난 시간에 UIBarAppearance에 대해 찾아보면서 시스템 바에 흐림 효과를 주는 방법에 대해서도 알아보았었는데요. 이번 시간에는 시스템 바가 아닌 뷰에 흐림 효과를 주는 방법에 대해 알아보겠습
meenu.tistory.com
'UIKIT' 카테고리의 다른 글
viewModel.$user에서 user 앞에 $를 붙이는 이유 (0) | 2025.01.08 |
---|---|
ViewModel을 사용하는 목적 (0) | 2025.01.08 |
UICollectionReusableView와 UIView의 차이 + headerSection (0) | 2025.01.05 |
UIFontMetrics (0) | 2025.01.05 |
키보드 내리기 (0) | 2024.12.27 |