2017-04-30 4 views
0

내 UINavigationBar의 배경색을 사용자 지정 UIColor로 변경하려고 시도하지만 표시되는 색은 녹색으로 변합니다. 나는이 문제가 iOS10을 사용하고 있기 때문에 내 사용자 지정 UIColor가 sRGB로 렌더링된다는 사실이지만 기본 색조를 변경하는 방법을 알지 못한다고 생각합니다. Apple Developer Guide에서 내 솔루션을 찾으려고했지만 해결책을 찾지 못했습니다. 혹시 저를 올바른 방향으로 가르쳐 주시겠습니까?UINavigationBar 색이 희미하고 올바른 색이 아닙니다.

도움/의견을 보내 주시면 대단히 감사하겠습니다.

AppDelegate.swift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
    UINavigationBar.appearance().backgroundColor = UIColor(red: 63/255, green: 237/255, blue: 0/255, alpha: 1.0) 
} 

컬러 내가 원하는 :

![enter image description here

실제 색상 (내 애플 리케이션 중 차단 세부 사항) :

enter image description here

답변

0

나는 할 수 있었다 내 문제를 해결할 수 있습니다.

backgroundColor를 사용하는 대신 barTintColor를 사용했습니다.

코드 :

class NavigationController: UINavigationController { 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     navigationBar.barTintColor = UIColor(red: 63/255, green: 237/255, blue: 0/255, alpha: 1.0) 
    } 
}