Override activity performed by built-in UIActivity types
Asked Answered
B

2

5

Is it possible to override the activity that's performed by the built-in UIActivity types used by UIActivityViewController?

For example, I would like the Facebook activity to use my own custom view instead of the built-in one. I know you can subclass UIActivity to make your own app-specific activities, but are you always stuck with the default behavior for the built-in ones?

Botello answered 7/1, 2013 at 22:35 Comment(1)
Yes you can customize the any UIActivityAnxiety
N
6

You can't override the built-in ones. The best you can do is deactivate them and replace them with your own subclasses of UIActivity. Functionally, this would have the same effect as overriding them.

Visually however this means that you have to provide your own icon images for these services. Apple's code will then take these images, throw away the colour data and use the alpha map to make a greyscale-tinted version set against Apple's usual black-dotted background. You can't provide colourful images for your own custom activities. Presumably this is to stop people from copying the 'official' service icons and subverting them for their own purposes, i.e. pretending to post something to Facebook while actually doing something quite different.

Niels answered 2/5, 2013 at 11:0 Comment(1)
I was afraid that was the only way. Not nearly as nice.Botello
K
1

You cannot override the behavior of the built-in UIActivity types - you can however override the data they get by providing your own UIActivityItemProvider subclass. For this you'll have to overide – activityViewController:itemForActivityType: So while it's not 100% what you're looking for you can at least bend the built-in ones a bit to your will.

Kyne answered 15/1, 2014 at 10:3 Comment(1)
#26452083Eugeniaeugenics

© 2022 - 2024 — McMap. All rights reserved.