短信收件人控件出现黑条的解决方案。
设置了
[UINavigationBar appearance]
的话,如果调用:
MFMessageComposeViewController或MFMailComposeViewController
的话,会出现收件人一栏变成黑条的情况,要在new前加上:
- (void)sendMessage:(UIViewController*)vc withNumber:(NSString*)number withText:(NSString*)text
{
// Send MSM
BOOL canSendSMS = [MFMessageComposeViewController canSendText];
if (canSendSMS) {
[[UINavigationBar appearance] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
picker.body = text;
picker.recipients = [NSArray arrayWithObject:number];
self.currentVC = vc;
[vc presentModalViewController:picker animated:YES];
}
}
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
if(result == MessageComposeResultSent){
[AlertControlls showAlertViewWithSuccess:@"发送成功."];
}
else if(result == MessageComposeResultFailed){
[AlertControlls showAlertViewWithSuccess:@"发送失败."];
}
[FlatTheme styleNavigationBarWithFontName:@"Avenir" andColor:MAIN_COLOR];
[self.currentVC dismissModalViewControllerAnimated:YES];
}