Mac*_*ade 12
你需要使用这个UIDocumentInteractionController
课程.
它在UIKit中可用,因此您不需要特定的框架.
您使用要传递给另一个应用程序的文件的URL来实例化此类,该应用程序能够处理文件类型:
UIDocumentInteractionController * controller;
controller = [ UIDocumentInteractionController interactionControllerWithURL: someFileURL ];
Run Code Online (Sandbox Code Playgroud)
然后,你可以呈现它:
[ controller presentOpenInMenuFromRect: someRect inView: someView animated: YES ];
Run Code Online (Sandbox Code Playgroud)
请注意,在iPad上,您需要保留控制器,否则它将被取消分配,从而导致应用程序崩溃.
此方法返回一个BOOL
值.NO
如果未找到文件类型的应用程序,则返回.在这种情况下,您可以显示警报.
归档时间: |
|
查看次数: |
4294 次 |
最近记录: |