2012-06-12 6 views
13

일반적인 viewController에서 네비게이션의 주 제목 색을 변경하는 데는 문제가 없지만 MFMailComposeViewController에서는 불가능합니다. 버튼의 색상을 변경 (취소 및 전송) 할 수 있으며 탐색 모음의 배경을 설정할 수는 있지만 제목의 색상을 변경할 수는 없습니다. 나는 새로운 제목 (분명히, 그것은 애플이 허용하지 것), 난 그냥 색상을 변경하려면 설정하지 않습니다. (MFMailComposeViewController 내비게이션의 주 제목 색을 변경하십시오.

저를 도와주세요 '를 감사

+0

이 링크를 참조하십시오 : http://stackoverflow.com/questions/1634417/changing-mfmailcomponentsviewcontrollers-toolbar-color – Dee

답변

16
NSDictionary *navbarTitleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys: 
              [UIColor whiteColor],UITextAttributeTextColor, 
              [UIColor blackColor], UITextAttributeTextShadowColor, 
              [NSValue valueWithUIOffset:UIOffsetMake(-1, 0)], UITextAttributeTextShadowOffset, nil]; 

[[UINavigationBar appearance] setTitleTextAttributes:navbarTitleTextAttributes]; 

또는

navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor yellowColor] forKey:UITextAttributeTextColor]; 

검은 색 이외의 색에 대한

10
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc]init]; 
    picker.mailComposeDelegate = self; 
    [[picker navigationBar] setTintColor:[UIColor blackColor]]; 
+0

내가 검색 한 내용이 아닌데 여기 탐색 모음의 색을 바꿉니다. 저), 제목보기의 색깔을 바꾸고 싶습니다 – user1451163

+0

하지만 감사해야합니다 ^^ – user1451163

0

는이 코드 놀러 .. 당신을 위해 작업을 희망 :

MFMailComposeViewController *mailController = [MFMailComposeViewController new]; 

      [mailController.navigationBar setTintColor:[UIColor colorWithHue:240.0f/359.0f 
                    saturation:85.0f/100.0f 
                    brightness:60.0f/100.0f 
                     alpha:0.0f]]; 
13

이 올바른 iOS의 7, 8, 9에 대한 답변 및 10 : 왜

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; 
picker.mailComposeDelegate = self; 
[[picker navigationBar] setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor blackColor] forKey:NSForegroundColorAttributeName]]; 
여기

인 :

수표 상기 응답 표시 (기준 마니)가 [UINavigationBar appearance]을 참조하는 것은 올바르지 않습니다. 이는 UINavigationBar에있는 제목의 색상이 변경되어 MFMailComposeViewController도 표시되기 때문에 원하지 않는 효과였습니다. 내 코드처럼 피커의 NavBar를 구체적으로 가져와야합니다.

설정 tintColor도 제목이 아닌 버튼의 색상을 설정하므로 iOS 7 (Mani의 다른 답변) 설정은 올바르지 않습니다.

또한 UITextAttributeTextColor은 (는) 더 이상 지원되지 않습니다. NSForegroundColorAttributeName을 사용하십시오.

관련 문제