0

I'm working on incorporating sMFMailComposer for sending text messages in my app. Below is my code for creating and displaying the message sharing component:

- (void)shareWithMessages {
    
    if(![MFMessageComposeViewController canSendText]) {
        UIAlertView *warningAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your device doesn't support SMS!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [warningAlert show];
        return;
    }
    
    NSString *message = self.articleTitle;
    message = [message stringByAppendingString:@" "];
    message = [message stringByAppendingString:self.urlString];
    
    MFMessageComposeViewController *messageController = [[MFMessageComposeViewController alloc] init];
    messageController.messageComposeDelegate = self;
    [messageController setBody:message];
        
    // Present message view controller on screen
    [self presentViewController:messageController animated:YES completion:nil];
}

When the sharing composer is shown, the "New Message" text is displayed in white:

enter image description here

I tried setting the tint color like so:

[[messageController navigationBar] setTintColor:[UIColor blackColor ]];

...but that had no effect. Does anyone know why the text is set to white, and therefor unreadable?

Community
  • 1
  • 1
narner
  • 2,908
  • 3
  • 26
  • 63

1 Answers1

0

Probably somewhere in your code you are changing the [UINavigationBar appearance]. So try setting up the appearance of the UINavigationBar before calling

shareWithMessage

Maybe one of the following 3 do the trick:

[[UINavigationBar appearance] setTintColor:[UIColor yourColor]];
[[UINavigationBar appearance] setBarTintColor:[UIColor yourColor]];
[[UINavigationBar appearance] setTitleTextAttributes:
     @{NSForegroundColorAttributeName:[UIColor yourColor]}];
Pau Senabre
  • 4,155
  • 2
  • 27
  • 36
  • Hmm, good call. I was setting the appearance globally in the `AppDelegate`. I tried your suggestion right before the call to ` [self presentViewController:messageController animated:YES completion:nil];`, but it still got the same result. Similarly, I also tried `[[messageController navigationBar] setTintColor:[UIColor blackColor ]];`, and still nothing. – narner Apr 13 '16 at 19:31