Swift를 사용하여 TabBar 선택 시 색상 및 글꼴 변경
Swift로 TabBar가 선택한 색상과 글꼴을 변경하는 방법
TabBarController.swift
override func viewDidLoad() {
super.viewDidLoad()
let font:UIFont! = UIFont(name:"HelveticaNeue-Bold",size:10)
let selectedAttributes:NSDictionary! = [NSFontAttributeName : font, NSForegroundColorAttributeName : UIColor(red:0.13, green:0.55, blue:0.83, alpha:1.0)]
UITabBarItem.appearance().setTitleTextAttributes(selectedAttributes, forState: UIControlState.Selected)
UITabBar.appearance().tintColor = UIColor(red: 0.13, green: 0.55, blue: 0.83, alpha: 1.0)
}
이렇게 하면 간단하게 색깔을 바꿀 수 있다.
Reference
이 문제에 관하여(Swift를 사용하여 TabBar 선택 시 색상 및 글꼴 변경), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/nagatasci/items/8091f0358c6c51ddf697텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)