UIActivityViewController - 电子邮件和Twitter分享 [英] UIActivityViewController - Email and Twitter sharing

查看:251
本文介绍了UIActivityViewController - 电子邮件和Twitter分享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始与UIActivity合作分享我的应用程序到世界,但我几乎没有问题。 首先,我没有找到如何设置我的电子邮件主题。有没有办法?第二,当我设置我的电子邮件的正文时,有一个额外的输入(电子邮件的第一行是空白的,我的文本从第二行开始)。这是代码:

I recently started working with UIActivity to share my app to the world, but I have few problems. First, I didn't find how to set the subject of my email. Is there any way? Second, when I set the body text of my email, there is a extra "enter" (first line of the email is blank and my text starts at the second line). Here's the code:

 NSMutableArray *array = [[NSMutableArray alloc] initWithObjects: @"Test", nil];

    UIActivityViewController *activityViewController = [[UIActivityViewController alloc]
                                   initWithActivityItems:array applicationActivities:nil];

在电子邮件中,它显示:

And in the email, it shows that:

测试

第三:有没有办法知道哪些共享方法已被选中?因为我想在Twitter上分享一个主题标签,但是现在它也被收录在电子邮件中,这显然没有意义。

Third: is there a way to know which sharing method has been selected? Because I want to include a hashtag in my post when the user shares on twitter, but now it gets integrated in the email also, which obviously doesn't make sense.

谢谢!

推荐答案

强大的>使用iOS6上的UIActivityViewController的电子邮件,这是任何人都可以使用的最佳解决方案。所有您需要做的是在初始化UIActivityViewController时调用以下内容。

For adding subject to the email using UIActivityViewController on iOS6, this is the best solution that anyone can use.. All you have to do is call the following while initializing UIActivityViewController.

UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];
[activityViewController setValue:@"My Subject Text" forKey:@"subject"];

您的UIActivityViewController填充了一个主题。

And your UIActivityViewController is populated with a subject.

这篇关于UIActivityViewController - 电子邮件和Twitter分享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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