问题描述
我正在尝试通过单击按钮来呈现一个简单的 MFMessageComposeController。一切正常,但我无法更改取消的颜色,也无法从 iOS 13 全屏显示。
我用代码试过
messageController.navigationBar.tintColor = [UIColor greenColor];
messageController.navigationBar.barTintColor = [UIColor blueColor];
以及制作全屏
messageController.modalPresentationStyle = UIModalPresentationFullScreen;
#import "MessageViewController.h"
#import <MessageUI/MessageUI.h>
@interface MessageViewController ()<MFMessageComposeViewControllerDelegate>
@end
@implementation MessageViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (IBAction)sendMessage:(UIButton *)sender {
[self.view endEditing:YES];
if([MFMessageComposeViewController canSendText]) {
MFMessageComposeViewController *messageController = [[MFMessageComposeViewController alloc] init]; // Create message VC
messageController.navigationBar.tintColor = [UIColor greenColor];
messageController.navigationBar.barTintColor = [UIColor blueColor];
messageController.messageComposeDelegate = self; // Set delegate to current instance
NSMutableArray *recipients = [[NSMutableArray alloc] init]; // Create an array to hold the recipients
[recipients addobject:@"555-555-5555"]; // Append example phone number to array
messageController.recipients = recipients; // Set the recipients of the message to the created array
messageController.body = @"Example message"; // Set initial text to example message
// disabling the select recepient by adding the transparent view overit
dispatch_async(dispatch_get_main_queue(),^{ // Present VC when possible
[self presentViewController:messageController animated:YES completion:^{
UIView* paintView=[[UIView alloc]initWithFrame:CGRectMake(0,50,messageController.view.frame.size.width,60)];
UIColor *myColor = [[UIColor whiteColor] colorWithAlphaComponent:0.3f];
[paintView setBackgroundColor: myColor];
paintView.userInteractionEnabled = false;
[messageController.view addSubview:paintView];
}];
});
}
}
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {
[self dismissViewControllerAnimated:YES completion:NULL];
}
@end
这是我得到的结果。如何在 iOS 13 及更高版本中更改取消颜色并使 MFMessageComposer 全屏显示?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)