Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 722
rob1302 Avatar asked Oct 16 '12 07:10

rob1302


3 Answers

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).

like image 117
pre Avatar answered Nov 09 '22 07:11

pre


Sharekit is an abstraction which is not customizable in the way you wish to use it. Apple controls the interface to these services.

Unfortunately, if you want to customize sharing and how it works, you will need to implement your own version of sharekit, with a UI and API entry points to these services.

Sharekit exists so that you dont have to do this. As needs change over time I expect Apple will add and remove services at will.

Using the API "as is" is your most sensible option.

like image 2
deleted_user Avatar answered Nov 09 '22 05:11

deleted_user


I found this awesome tutorial. It works great,

Custom UIActivityViewcontroller

like image 1
Mona Avatar answered Nov 09 '22 05:11

Mona