아이콘 디자인은 아래와 같이 앞 뒤의 아이콘 색상이 약간의 차이가 있다.
하지만 아래와 같이 일반적인 코드 작성으로 UITabBarController의 TabBarItem을 설정할 경우 원본 이미지와 다르게 tintColor가 적용된다,.
private func setTabBarAppearance() {
UITabBar.appearance().tintColor = Color.main
UITabBar.appearance().unselectedItemTintColor = Color.grey_4
let fontAttributes = [NSAttributedString.Key.font: UIFont.autoPretendard(type: .sb_10)]
UITabBarItem.appearance().setTitleTextAttributes(fontAttributes, for: .normal)
}
TabBarItem 관련해서 검색을 해보니, UITabBarController에서 설정을 변경해주는 것이 아니라, Asset에 아이콘을 추가할 때 적용하는 속성 값의 문제였다.
@ 참고
iOS) UITabBarController Setting: tab bar item image, text color
안녕하세요. zhi입니다! 지난번에 구현하고자 했던 UITabBarController에 view controllers를 다 연결했습니다. 😆 엇... 그런데 뭔가 2% 부족해보이지 않나요?? 원래 화면은 아래와 같습니다. 확대해서 비교
zhiblog.tistory.com
기존 Asset 파일 내에서 image의 Render As 속성 값은 default이다.
이를 Original Image로 변경해주면 된다.
TabBarItem이 아래와 같이 activate인 경우와 inactivate인 경우 모두 디자인이 제대로 적용된 것을 볼 수 있다.
👉🏻 The rendering mode controls how UIKit uses color information to display an image
https://developer.apple.com/documentation/uikit/uiimage/renderingmode
Apple Developer Documentation
developer.apple.com
UITextView Placeholder 및 글자 수 카운팅 (0) | 2022.12.19 |
---|---|
하위View touch event 부모View로 인식/전달 (0) | 2022.11.12 |
UITableView, UITableViewCell transparent (0) | 2022.11.08 |
UIStackView View 겹치기 (0) | 2022.11.07 |
UITabBarController (0) | 2022.11.06 |