gpt4 book ai didi

ios - 邮件编辑器不会从 UIPreviewAction 启动

转载 作者:行者123 更新时间:2023-12-01 17:20:17 25 4
gpt4 key购买 nike

在我的应用程序的 Peek View 的 View Controller 中,我有:

- (NSArray*)previewActionItems {  

/
UIPreviewAction *action1 = [UIPreviewAction actionWithTitle:@"Post to Facebook" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {


}];

UIPreviewAction *action2 = [UIPreviewAction actionWithTitle:@"Message" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {


}];

UIPreviewAction *action3 = [UIPreviewAction actionWithTitle:@"Email" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
[self displayComposerSheet];


}];

/
NSArray *actions = @[action1, action2, action3];

/
return actions;
}

这成功地允许我在 3D Touch 之后拉出一张预览 Action 表。 displayComposerSheet 是:
-(void)displayComposerSheet  
{
NSLog(@"Mail Button Pressed");
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"Check out this article from Fritch"];


/
NSArray *toRecipients = [NSArray arrayWithObject:@"friend@example.com"];

[picker setToRecipients:toRecipients];

/
NSString *emailBody = self.finalObject.articleImage;
[picker setMessageBody:emailBody isHTML:YES];

[self presentViewController:picker animated:YES completion:nil];
[picker release];
}

但是,邮件编写器从未出现。请帮忙。

最佳答案

问题可能是显示 Peek View 时 View 层次结构不正常。

尝试使用 Root View Controller 来呈现选择器:

[[UIApplication sharedApplication].delegate.window.rootViewController presentViewController:picker animated:YES completion:nil];

关于ios - 邮件编辑器不会从 UIPreviewAction 启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33020185/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com