实现UIActivityItemSource协议 [英] Implementing the UIActivityItemSource protocol

查看:618
本文介绍了实现UIActivityItemSource协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这些协议方法,

activityViewControllerPlaceholderItem: activityViewController:itemForActivityType:

但它们永远不会被调用。如何告诉 UIActivityViewController 来调用它们?

but they never get called. How do I tell the UIActivityViewController to call them?

我还有 UIActivityItemProvider 子类,但我很困惑谁调用这两种方法。我真的很感激一些示例代码,因为我在网上找不到任何东西。 :)

I also have an UIActivityItemProvider subclass, however I'm confused as to who calls these 2 methods. I'd really appreciate some sample code, as I can't find anything on the web. :)

推荐答案

根据文档。您传递给
-initWithActivityItems:applicationActivities:的活动项数组可以是数据对象的数组,如字符串或图像,或者它可以是实现 UIActivityItemSource 协议的对象数组。

According to the documentation. The array of activity items that you pass to
-initWithActivityItems:applicationActivities: can be an array of data objects, like strings or images, or it can be array of objects that implement the UIActivityItemSource protocol.

如果传递实现<$的对象数组c $ c> UIActivityItemSource 协议然后您的 UIActivityViewController 实例将在您的活动项目上调用这些方法。这些对象不一定必须是 UIActivityItemProvider 的子类。 UIActivityItemProvider 只是一个符合此协议的类。

If you pass an array of objects that implement the UIActivityItemSource protocol then your instance of UIActivityViewController will call those methods on your activity items. Those objects do not necessarily have to be subclasses of UIActivityItemProvider. UIActivityItemProvider is just a class that conforms to this protocol.

这篇关于实现UIActivityItemSource协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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