Creating a custom sharing view similar to new iOS 6 button sharing

rob1302 picture rob1302 · Oct 16, 2012 · Viewed 10.4k times · Source

With the new iOS 6, Apple added the new UIActivityViewController (image A) sharing menu which has little icon buttons to share instead of just the old UIActionSheet text button.

I want to display a UIActivityViewController but with custom buttons. I know they have a list of default applications that can displayed (Mail, Messages, Facebook, Twitter, etc...) but I want to customize what happens when you click on those buttons. When you click the Mail sharing icon it opens the Mail app with a new message, as an example i'd like it if when clicking on the Mail app, it opens the Twitter app (not really, but just something different than the default). Right now I can't seem to find a way to add my own methods behind the buttons.

With the latest ShareKit they added Instagram sharing and when you select to share with it a new view is displayed which looks exactly like the UIActivityViewController screen (image B). They seemed to have figured out how to add custom buttons that do custom things. I searched through the ShareKit code but can't seem to find where or how this is working out.

Maybe what i'm asking isn't even possible yet but any help is appreciated!

image Aimage A

image Bimage B

Answer

pre picture pre · Oct 16, 2012

Have look at this link. It's a pretty good introduction into sharing on iOS 6.

The following quote is from this blog post:

You can even add support for your own custom sharing options and still let UIActivityViewController handle the interaction with the user. To do that, subclass the abstract UIActivity class and override the required methods (see the documentation for details).