问题
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];
Now, when I close QLPreviewController
or previewController
this method is called:
- (void)previewControllerDidDismiss:(QLPreviewController *)controller {
NSLog(@"You closed the document");
}
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
}
Can anyone please help?
Many thanks.
回答1:
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
来源:https://stackoverflow.com/questions/28941178/ios-get-documents-url-when-qlpreviewcontroller-is-closed