iOS-关闭QLPreviewController时获取文档的URL [英] iOS - get document's URL when QLPreviewController is closed

查看:111
本文介绍了iOS-关闭QLPreviewController时获取文档的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码可预览PDF文件:

I have this code which previews the PDF file:

QLPreviewController *previewController=[[QLPreviewController alloc]init];
previewController.delegate=self;
previewController.dataSource=self;
[self presentModalViewController:previewController animated:YES];

现在,当我关闭QLPreviewControllerpreviewController时,此方法称为:

Now, when I close QLPreviewController or previewController this method is called:

- (void)previewControllerDidDismiss:(QLPreviewController *)controller {
    NSLog(@"You closed the document");
}

现在,当我调用此方法时,如何返回文档或Pdf的URL:

Now, how I can return the document's or Pdf's URL when I call this method:

- (void)previewControllerDidDismiss:(QLPreviewController *)controller {
        //here I need to be able to get the PDF's URL or Data when is closed
    }

任何人都可以帮忙吗?

非常感谢.

推荐答案

检查文档

Check documentation here. There is another method, that responds to user actions and returns needed URL:

- (BOOL)previewController:(QLPreviewController *)controller
            shouldOpenURL:(NSURL *)url
           forPreviewItem:(id<QLPreviewItem>)item

这篇关于iOS-关闭QLPreviewController时获取文档的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆