Create a custom sharing view similar to the new iOS 6 button sharing

With the new iOS 6, Apple has added a new UIActivityViewController sharing menu (Image A), which has several icon buttons for sharing instead of the old UIActionSheet text button.

I want to display a UIActivityViewController, but with custom buttons. I know that they have a list of default applications that can be displayed (Mail, Messages, Facebook, Twitter, etc.), but I want to configure what happens when you click on these buttons. When you click on the “Messaging” icon, it opens the “Mail” application with a new message, as an example that I would like if, when I click on the “Mail” application, it opens the Twitter application (not quite, but just something else than the default) Right now I can’t find a way to add my own methods behind the buttons.

With the latest ShareKit, they added Instagram sharing, and when you decide to share it, a new view will appear that looks exactly like the UIActivityViewController screen (image B). They seemed to understand how to add custom buttons that do custom things. I was looking for ShareKit code, but could not find where and how it works.

Perhaps what I ask is not yet possible, but any help is appreciated!

image A image A

image B image B

+6
source share
4 answers

Look at the link. This is a pretty good introduction to iOS 6.

The following quote from this blog post:

You can even add support for your own sharing options and still let the UIActivityViewController handle user interaction. To do this, subclass the abstract class UIActivity and override the necessary methods (for more details, see the Documentation).

+9
source

Sharekit is an abstraction that is not customizable the way you want to use it. Apple manages the interface for these services.

Unfortunately, if you want to configure sharing and how it works, you will need to implement your own version of sharekit, while the entry points to the interface and the API will be displayed in these services.

Sharekit exists, so you do not need to do this. As needs change over time, I expect Apple to add and remove services as it sees fit.

Using the API “as is” is your most sensible option.

+2
source

I found this wonderful tutorial. It works great

Custom UIActivityViewcontroller

+1
source

Image B actually uses the Instagrams documentation interaction code, not the UIActivityViewController with the custom UIActivity. You can learn more about Instagram hooks here ... iphone custom hooks

UIActivity was created by a third party for Instagram, which you can find here. This opens the same menu as ShareKit when selected because it is the only way to transfer the image directly to Instagram.

0
source

Source: https://habr.com/ru/post/927815/


All Articles