안녕하세요 iOS 개발자 워너비 루크입니다!
오늘은 navigationBar 커스터마이징 방법에 대해서 알아볼게요!
빠른 설명 들어갑니다!
빠른 사용법
override func viewWillAppear(_ animated: Bool) {
navigationController?.navigationBar.barTintColor = UIColor(named: "main")
navigationController?.navigationBar.backgroundColor = UIColor(named: "main")
navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.white]
navigationController?.navigationBar.tintColor = UIColor.white
}
override func viewWillDisappear(_ animated: Bool) {
navigationController?.navigationBar.barTintColor = nil
navigationController?.navigationBar.backgroundColor = nil
navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.black]
navigationController?.navigationBar.tintColor = .black
}
Swift
복사
뷰 스크