Question

The Photos app in iOS 7 allows you to select multiple photos, tap "Share" and be presented with a document interaction controller with the appropriate options for multiple items.

The Camera app goes one further and even updates the document interaction controller's options in real time as you select and deselect photos.

However, the UIDocumentInteractionController class seems only to allow for a single URL parameter.

Is it possible to do what the Photos and Camera apps do using public API?

Was it helpful?

Solution

- (void)showShareDialog
{
    UIImage *image = [UIImage imageWithCGImage:self.imgView.image.CGImage];

    NSArray* dataToShare = @[image, image2, image3];  // ...or whatever pieces of data you want to share.

    UIActivityViewController* activityViewController =
    [[UIActivityViewController alloc] initWithActivityItems:dataToShare
                                      applicationActivities:nil];
    [self presentViewController:activityViewController animated:YES completion:^{

    }];

}

I think this should help

OTHER TIPS

Store the URLs of the selected items in an array. You can change the actions displayed depending upon the number of elements in the array. After the user makes his/her selection, you can loop through the URLs and apply the selected action.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top