UIActivityViewController 在特定操作中使用项目 [英] UIActivityViewController use items in specific actions

查看:49
本文介绍了UIActivityViewController 在特定操作中使用项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UIActivityViewController,我想让它拥有 safari 所做的所有操作等等.目前我只能收到邮件、消息、推特、脸书和半工作副本.我使用 url 设置活动项数组.然后我添加了该 url 的 nsstring 并将其与 url 一起添加,一切都很好,就像通过复制字符串来复制效果更好,我将其粘贴到更多区域.但是当也有字符串时,twitter 和 facebook 将 url 添加到他们的文本中并包含链接.我怎样才能让他们没有文字,只有链接?另一个问题是如何在 twitter 和 facebook 活动的链接中显示 web 视图预览?它只显示一个 safari 图标.第三个问题是如何打印网页内容?

I have a UIActivityViewController and i want to make it have all the actions safari does and more. Currently i can only get mail, messages, twitter, facebook and a semi-working copy. I set the activity items array with a url. I then added a nsstring of that url and added that with the url, and everything worked good like copying worked better by copying the string and i paste it in more areas. But when having the string also, twitter and facebook added the urls into their text and include the link. How can i make it so they dont have the text, just the link? Another issue is how can i show the web view preview in the link on the twitter and facebook activities? it just shows a safari icon. And third question is how can i print the contents of the web page?

推荐答案

为了为不同的服务提供不同的项目,你将 UIActivityItemProvider 子类化.它符合UIActivityItemSource协议,所以你实现方法:

To provide different items for different services, you subclass UIActivityItemProvider. It conforms to UIActivityItemSource protocol, so you implement method:

- (id)activityViewController:(UIActivityViewController *)activityViewController
         itemForActivityType:(NSString *)activityType {
    // compare `activityType` and return what you want
}

这篇关于UIActivityViewController 在特定操作中使用项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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