2013-10-16 89 views
4

我設置並打開我的MFMessageComposeViewController下列要求:如何更改MFMessageComposeViewController元素的顏色?

- (void)openSMSViewWithRecipientsArray:(NSArray *)recipients { 
    MFMessageComposeViewController *messageVC = [MFMessageComposeViewController new]; 

    if([MFMessageComposeViewController canSendText]){ 
     messageVC.body = @""; 
     [[messageVC navigationBar] setTintColor:[UIColor whiteColor]]; 
     messageVC.recipients = recipients; 
     messageVC.messageComposeDelegate = self; 
     [self presentViewController:messageVC animated:YES completion:nil]; 
    } 
} 

但畫面看起來是這樣的:

enter image description here

那麼,如何改變無論是紫色的背景,其中的數字是,或者改變數字顏色和加號顏色?

回答

5

我不能只改變紫色背景,其中數字是,所以我不得不改變整個導航欄的顏色,因此將適用於數字背景:

- (void)setNavBarColor:(UIColor *)navBarColor titleColor:(UIColor *)titleColor { 
    [[UINavigationBar appearance] setBarTintColor:navBarColor]; 
    [[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: 
                  [UIFont fontWithName:@"Futura-Medium" size:17.0f], 
                  UITextAttributeFont, 
                  titleColor, 
                  UITextAttributeTextColor, 
                  nil]]; 
} 
+0

這工作非常出色,謝謝。 – Laith

+0

我應該在哪裏調用方法 - (void)setNavBarColor :(UIColor *)navBarColor titleColor:(UIColor *)titleColor – user2955351

+1

@ user2955351,在初始化'MFMessageComposeViewController'之前。 –