I've got a UIActivityViewController
which allows the user to share an image they've created to one of several activity types (facebook, twitter, save to camera roll, print, etc.).
Since I want the image to be saved/sent at different quality levels depending on the activity (high-resolution to print, low-res for twitter), I'm using a custom UIActivityItemProvider
to (duh) provide the image.
Rendering the hi-res version takes some time, so I want to display an activity indicator while it's doing its thing. The apple docs make reference to doing just that, actually.
But I can't seem to figure out the "right" places to put the hooks for displaying my progress indicator... where should they go?
UPDATE:
Tried the following in the - (id) activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType
method:
[self performSelectorOnMainThread:@selector(startSpinnerWithMessage:) withObject:message waitUntilDone:YES];
self.shareImage = [self.delegate imageForActivityOfType:activityType]; // code that actually generates the image; takes a while.
[self performSelectorOnMainThread:@selector(endSpinner) withObject:nil waitUntilDone:YES];
...does not do the job. When I tap the activity button, the UI freezes while the image is generated, and then when it finishes, I see the spinner for a split second and then it disappears.
I think the positioning of the endSpinner call makes sense... however, it seems that the startSpinner call needs to go somewhere else. No idea what to do here.