Example of how to customize UIActivityViewController share menu?

前端 未结 1 348
无人共我
无人共我 2020-12-31 13:05

Is there an example of how to customize UIActivityViewController share menu with my own icon and IBAction?

I have seen this...



        
相关标签:
1条回答
  • 2020-12-31 13:50

    You first need to subclass UIActivity.

    Then you need to override certain methods, including activityImage for setting the icon and performActivity for performing the action (what you call "IBAction" in your question).

    If instead of performing the action silently, you first need further user interaction and info for your custom activity (e.g., like the Twitter post for the standard UIActivity), you should override activityViewController rather than performActivity.

    After you have subclassed UIActivity (as, e.g, MyActivity), you should create an instance of MyActivity and make it an element of the applicationActivities array that you pass to initWithActivityItems:applicationActivities:.

    Have a look at the documentation for UIActivity for exactly what you need to override when subclassing and for icon requirements.

    Hope this helps a little.

    0 讨论(0)
提交回复
热议问题