MFMailComposeViewController 不是交互式的
我在两个视图控制器中使用以下代码;一种是通过按下按钮触发,另一种是通过点击表格单元格触发。首先,它工作得很好。
在第二个中,由表格单元格点击触发,邮件编辑器出现,字段正确填写,但光标和键盘不出现,因此您实际上无法在邮件消息中输入任何内容。 (您可以毫无问题地点击“取消”或“发送”。)知道出了什么问题吗?谢谢!
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Message subject"];
[picker setMessageBody:@"Sample message" isHTML:NO];
[self presentModalViewController:picker animated:YES];
[picker release];
} else {
NSLog(@"cant send mail");
}
I'm using the following code in two view controllers; one, where it is triggered by pressing a button, and another, where it is triggered by tapping a table cell. In the first, it works fine.
In the second, triggered by the table-cell tap, the mail composer appears, with the fields correctly filled out, but the cursor and keyboard do not appear, so you can't actually enter anything into the mail message. (You can hit Cancel or Send without problems.) Any idea what's wrong? Thanks!
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Message subject"];
[picker setMessageBody:@"Sample message" isHTML:NO];
[self presentModalViewController:picker animated:YES];
[picker release];
} else {
NSLog(@"cant send mail");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了这个问题,但这绝对是荒谬的——可能是 SDK 中的一个错误。我用 UIModalTransitionStyleFlipHorizontal 呈现问题 UIViewController,同时用默认过渡样式呈现健康的 UIViewController。关于 UIModalTransitionStyleFlipHorizontal 的某些事情似乎使呈现的视图控制器贪婪地成为第一响应者;它不会将第一响应者状态放弃给已启动的 MFMailComposeViewController。
I figured out the problem, but it's absolutely ridiculous -- probably a bug in the SDK. I was presenting the problem UIViewController with a UIModalTransitionStyleFlipHorizontal, while I was presenting the healthy UIViewController with the default transition style. Something about the UIModalTransitionStyleFlipHorizontal seems to make the presented view controller greedy to be first-responder; it won't give up first-responder status to the launched MFMailComposeViewController.