MFMailComposer外观不正确

时间:2016-04-13 16:02:03

标签: ios mfmailcomposeviewcontroller mfmailcomposer

我正在努力合并s MFMailComposer,以便在我的应用中发送短信。下面是我创建和显示消息共享组件的代码:

- (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];
}

当显示共享作曲家时,"新消息"文字以白色显示:

enter image description here

我尝试设置色调颜色如下:

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

......但这没有效果。有谁知道为什么文本设置为白色,因此不可读?

1 个答案:

答案 0 :(得分:0)

您的代码中可能正在改变[UINavigationBar外观]。因此,在调用

之前尝试设置UINavigationBar的外观
shareWithMessage

以下3个中的一个可能会做到这一点:

[[UINavigationBar appearance] setTintColor:[UIColor yourColor]];
[[UINavigationBar appearance] setBarTintColor:[UIColor yourColor]];
[[UINavigationBar appearance] setTitleTextAttributes:
     @{NSForegroundColorAttributeName:[UIColor yourColor]}];