Mason G. Zhwiti
Mason G. Zhwiti

Reputation: 6540

Am I not understanding UIActivityViewController, or does the implementation currently suck?

I'm trying to move my app to use UIActivityViewController, rather than UIActionSheet, so that I get the fancy graphical sharing buttons rather than the textual buttons. (My app is targeted at iOS 6 only.)

After trying to work with it for a couple nights, it seems either I am totally misunderstanding how to use it, or the current implementation by Apple is terrible:

I hope I'm wrong!

Upvotes: 4

Views: 4279

Answers (2)

Hampus Nilsson
Hampus Nilsson

Reputation: 6822

You are better off using a custom component that behaves like UIAcitvityController as it is quite limited, as you noted.

This is one example: https://github.com/hjnilsson/REActivityViewController , I just forked it from https://github.com/romaonthego/REActivityViewController to allow you to set the email subject field.

Upvotes: 1

Tricertops
Tricertops

Reputation: 8512

Is there a way to set custom content for each type of activity?

Yes, I guess you should subclass UIActivityItemProvider and override method –activityViewController:itemForActivityType: with your logic (e.g. trim string to 140 chars for Twitter).
Then pass an instance of this class to -[UIActivityViewController initWithActivityItems:applicationActivities:].


Is there actually a way to set the subject line and optionally, the recipients?

You are right, the mailto scheme should be able to set these fields. If it is not working, I consider this as bug. (Didn't try this myself, but I will give it a check.)


Is there a way to use Apple's service icons, but have a chance to customize the behavior?

I think you can't do this. (Unless you want to hack those system activities.)

Upvotes: 7

Related Questions