Opening a file by UIDocumentInteractionController

后端 未结 1 1425
北海茫月
北海茫月 2021-01-06 10:03

I am using UIDocumentInteractionController for opening documents in my app. I have used method below for previewing the PDF file:-

- (IBAction)p         


        
相关标签:
1条回答
  • 2021-01-06 10:34

    Previewing the PDF document and sharing.

    Set Delegate Method:- UIDocumentInteractionControllerDelegate

    NSURL *URL = [[NSBundle mainBundle] URLForResource:@"Your PDF Name" withExtension:@"pdf"];
    UIDocumentInteractionController *documentInteractionController =[UIDocumentInteractionController interactionControllerWithURL:URL];
    documentInteractionController.delegate = self;
    [documentInteractionController presentPreviewAnimated:YES];
    
    - (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller {
    return self;
    }
    

    If you have any confusion, click on the below link and read : https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/PreviewingandOpeningItems.html

    0 讨论(0)
提交回复
热议问题