MFMailComposer 外观不正确
Incorrect with MFMailComposer Appearance
我正在努力将 sMFMailComposer
用于在我的应用程序中发送短信。下面是我创建和显示消息共享组件的代码:
- (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];
}
显示分享编辑器时,“新消息”文本显示为白色:
我试过像这样设置色调:
[[messageController navigationBar] setTintColor:[UIColor blackColor ]];
...但这没有效果。有谁知道为什么文本设置为白色,因此无法阅读?
可能在您的代码中某处您正在更改 [UINavigationBar 外观]。所以在调用
之前尝试设置 UINavigationBar 的外观
shareWithMessage
也许以下 3 个之一可以解决问题:
[[UINavigationBar appearance] setTintColor:[UIColor yourColor]];
[[UINavigationBar appearance] setBarTintColor:[UIColor yourColor]];
[[UINavigationBar appearance] setTitleTextAttributes:
@{NSForegroundColorAttributeName:[UIColor yourColor]}];
我正在努力将 sMFMailComposer
用于在我的应用程序中发送短信。下面是我创建和显示消息共享组件的代码:
- (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];
}
显示分享编辑器时,“新消息”文本显示为白色:
我试过像这样设置色调:
[[messageController navigationBar] setTintColor:[UIColor blackColor ]];
...但这没有效果。有谁知道为什么文本设置为白色,因此无法阅读?
可能在您的代码中某处您正在更改 [UINavigationBar 外观]。所以在调用
之前尝试设置 UINavigationBar 的外观shareWithMessage
也许以下 3 个之一可以解决问题:
[[UINavigationBar appearance] setTintColor:[UIColor yourColor]];
[[UINavigationBar appearance] setBarTintColor:[UIColor yourColor]];
[[UINavigationBar appearance] setTitleTextAttributes:
@{NSForegroundColorAttributeName:[UIColor yourColor]}];