ios8 - 如何显示默认共享表 [英] ios8 - how to show the default share sheet

查看:121
本文介绍了ios8 - 如何显示默认共享表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提供并使用默认的分享到其他服务表格,以便分享到Twitter,Facebook,电子邮件等。

I want to present and use the default "share to other service" sheet in order to allow sharing to twitter, facebook, email, etc.

我可以' t弄清楚如何从我的应用程序显示这个视图 - 我该怎么做?

I can't figure out how to show this view from my app - how can i do that?

推荐答案

你可以使用简单的活动控制器使用以下方式显示默认共享应用程序:

You can use the simple activity controller to show default sharing apps using:

 NSArray *activityItems = [NSArray arrayWithObjects:shareString, shareImage, shareUrl, nil];
 UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
 activityViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

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

您也可以使用其完成处理程序:

And you can use its completion handler too:

[activityViewController setCompletionHandler:^(NSString *act, BOOL done)
     {
               //Code here when the action performed.

     }];

这将显示所有默认共享应用。

This will show all default sharing apps.

这篇关于ios8 - 如何显示默认共享表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆