2014-04-28 4 views
1

탐색 모음의 배경색을 검은 색으로, 탐색 모음의 텍스트를 흰색으로 지정하고 싶습니다.탐색 모음의 배경색 및 탐색 텍스트 색을 변경하는 방법

enter image description here

그러나

, 내가 탐색 모음의 배경색이 주황색 인 경우에도 7.1/w 실제 장치에서 테스트 제목 : 아래 그림과 같이

모든 내 시뮬레이터에 잘 보이는 화면의 검은 색입니다.

이것은 내가 내 응용 프로그램 위임에 뭘하는지입니다 :

@window.rootViewController = UINavigationController.alloc.initWithRootViewController(main_controller) 
@window.rootViewController.navigationBar.barTintColor = '#DF533B'.to_color 
@window.rootViewController.navigationBar.translucent = true 
@window.rootViewController.navigationBar.tintColor = UIColor.whiteColor 
@window.rootViewController.navigationBar.setTitleTextAttributes({ 
    UITextAttributeTextColor => UIColor.whiteColor 
}) 

deployment_target입니다 7.0app.sdk_version

7.1 내가 내 모든 컨트롤러의 viewDidLoad이 코드를 퍼팅해야합니까?

답변

0
RubyMotion에 익숙하지

,하지만 당신은 UIAppearance 프록시를 사용해야합니다 AppDelegate에 당신이 당신의 주 창을로드하기 전에

[[UINavigationBar appearance] setBarTintColor:[self navBarColor]]; 

[[UINavigationBar appearance] setTintColor:[self navBarTitleColor]]; 

[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [self navBarTitleColor], NSFontAttributeName : [self titleFont]}]; 

당신은이 작업을 수행해야합니다.

0

나에게 맞는 Moby의 답을 추가하기 만하면, 앱 위임자의 didFinishLaunchingWithOptions에 추가해야합니다.