gpt4 book ai didi

ios - 邮件 UIActivityViewController 不关闭

转载 作者:行者123 更新时间:2023-12-01 19:14:13 31 4
gpt4 key购买 nike

我有一个 UIActivityViewController 不会关闭 iPad 上的邮件对话框。该代码是来自 Apple 示例的标准代码,并且在 iPhone 上运行良好。

   NSString* someText = [NSString stringWithFormat:@"%@ Is really cool, sent from Element Story. en.wikipedia.info/wiki/%@",
[_detailItem description], [_detailItem description]];

ActivityViewCustomProvider *customProvider =
[[ActivityViewCustomProvider alloc]init];

NSArray *items = [NSArray arrayWithObjects:customProvider,imageView.image,someText, nil];

//ActivityViewCustomActivity *ca = [[ActivityViewCustomActivity alloc]init];


// ...or whatever pieces of data you want to share.
UIActivityViewController *activityVC =
[[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
//applicationActivities:[NSArray arrayWithObject:ca]];

activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypeCopyToPasteboard];
[self presentViewController:activityVC animated:YES completion:^{}];

最佳答案

我假设您正在从 splitviewcontroller 显示此内容,这也是我遇到的问题。本质上,您需要从主视图中呈现 UIActivityViewController。

所以而不是

[self presentViewController:activityVC animated:YES completion:nil];

就像是:
[[[self parentViewController] parentViewController] presentViewController:activityVC animated:YES completion:nil];
不幸的是,它看起来不太好,因为它会在整个 View 中显示选项,而不仅仅是在导航端或细节端的上下文中,但它会起作用。

关于ios - 邮件 UIActivityViewController 不关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14363355/

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