简体   繁体   中英

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:

在此处输入图片说明

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM