Michael
Michael

Reputation: 33297

How do I create an Open With Dialog in iOS?

I have a app that creates jpg images. Now I want to open a dialog which shows all the possible apps which can open a jpg image. When I tap on one of the apps in the dialog the tapped app should be opened and get the jpg image as parameter.

Here such a dialog from another app:

enter image description here

The dialog above shows all the apps where I can open my jpg image with.

How do I create and use such a dialog in iOS?

Upvotes: 0

Views: 608

Answers (1)

user523234
user523234

Reputation: 14834

In the UIDocumentInteractionController, there are two methods:

presentOpenInMenuFromBarButtonItem and presentOpenInMenuFromRect

Quite simple to use, first create and initialize an instance of UIDocumentInteractionController:

self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:yourFilePathURL];

Next present the open-in dialog using either one of the above mentioned methods.

Upvotes: 1

Related Questions