10

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

I have seen this...

- (id)initWithActivityItems:(NSArray *)activityItems applicationActivities:(NSArray *)applicationActivities;

but I have not gotten it to work yet.

DCForever
  • 62
  • 4
OscarTheGrouch
  • 2,374
  • 4
  • 28
  • 39
  • [http://stackoverflow.com/questions/12766300/how-can-i-create-a-custom-uiactivity-and-uiactivityprovider-in-ios-6][1] [1]: http://stackoverflow.com/questions/12766300/how-can-i-create-a-custom-uiactivity-and-uiactivityprovider-in-ios-6 This Shows exactly how to do it, in a little while I was post a Basic share app with only one button and the code. – OscarTheGrouch Oct 09 '12 at 15:16
  • I don't understand, do you still need this question answered? – Mick MacCallum Oct 12 '12 at 20:45
  • Someone else answered it in another question – OscarTheGrouch Oct 13 '12 at 00:11

1 Answers1

8

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.

Spiros
  • 709
  • 4
  • 9