Options button in the UIActivityViewController

Does anyone know how to include the Options button and functionality in the UIActivityViewController, that can be seen when sharing a photo for example: https://ibb.co/cc56qtY


We want our users to be able to decide what files to share in that Options dialog.

Replies

Where did you read there was an Options button in UIActivityViewController ?

That does not appear to be a UIActivityViewController.

It appears to be UIBarButtonItem(s) on a UIViewController that has been presented something like this:



    ChoicesViewController *choices = [[ChoicesViewController alloc] 
              initWithNibName:@"ChoicesViewController" bundle:nil]; // this is some UIViewController
    UINavigationController *navigationController = [[UINavigationController alloc]
                                                    initWithRootViewController:choices];
    navigationController.modalPresentationStyle=UIModalPresentationFormSheet;
    [self presentViewController:navigationController animated:YES completion:^{
        
    }];

Maybe this image better illustrates what I want to achieve, from what I guess is the UIActivityViewController, or am I wrong?

Hmm, ok! Then maybe it's not a UIActivityViewController that is being used? I realise this image better shows what I want to achieve. The "Options" button (marked in the image with the Swedish translation "Alternativ") is also present when sharing photos, as I mentioned earlier. Just thought that there would be some built-in functionality to include it from the UIAcitvityViewController.


Here's my current code for the UIActivityViewController:

// Init Activity view controller.
let activity = UIActivityViewController(
    activityItems: [path, pdfData],
  applicationActivities: nil
)

//Show the Activity view controller.
self.progressHUD.hide()
activity.popoverPresentationController?.barButtonItem = sender
activity.excludedActivityTypes = [.addToReadingList, .assignToContact, .copyToPasteboard, .markupAsPDF, .message, .openInIBooks, .postToFlickr, .postToTencentWeibo, .postToTwitter, .postToFacebook, .postToVimeo, .postToWeibo, .print, .saveToCameraRoll]
self.present(activity, animated: true, completion: nil)

> maybe it's not a UIActivityViewController that is being used?


Correct.


> thought that there would be some built-in functionality to include it from the UIAcitvityViewController.


It's not on a UIActivityViewController. "It" is a UIBarButtonItem on a UIViewController. The way you 'incude' it is with (in Objective-C, I don't do Swift):


    UIBarButtonItem *activButton =[[UIBarButtonItem alloc] 
             initWithTitle: @"Activ>" style:UIBarButtonItemStyleDone  
             target: self action: @selector(myAction)];
    self.navigationItem.rightBarButtonItem = activButton;