UIActivityViewController根据所选活动自定义文本 [英] UIActivityViewController customize text based on selected activity

查看:137
本文介绍了UIActivityViewController根据所选活动自定义文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为相同的信息自定义文本,但是当我在Facebook上分享它时,我不想使用twitter哈希标签或@username方案......

I want to customize text for the same information but when I am sharing it on Facebook I don't want to use the twitter hash tags or @username scheme...

如何基于将使用哪种共享服务来分散文本以进行共享?

How can I diversify text for sharing based on which sharing service would be used?

当然我正在使用UIActivityViewController:

Ofcourse I'm using UIActivityViewController:

UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[shareText, shareURL] applicationActivities:nil];


推荐答案

而不是将文本字符串传递给 initWithActivityItems 调用,传入您自己的的子类 UIActivityItemProvider 类,当您实现 itemForActivityType 方法时,它将提供共享服务作为'activityType'参数。

Instead of passing the text strings into the initWithActivityItems call, pass in your own sub-class of the UIActivityItemProvider class and when you implement the itemForActivityType method it will provide the sharing service as the 'activityType' parameter.

然后,您可以从此方法返回自定义内容。

You can then return the customized content from this method.

这篇关于UIActivityViewController根据所选活动自定义文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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