0

Which delegate function of UIDocumentInteractionControllerDelegate is called when document is completely loaded on the preview?
Just to share, I have already tried :

- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller  

And this is called when we close the preview.

Nitish
  • 13,845
  • 28
  • 135
  • 263

1 Answers1

2

This is a bit of a work around as there doesn't appear to be a completion handler for this in the documentation, as far as I can tell.

-(void)presentDocument:(NSURL*)url{
        UIDocumentInteractionController *docInteration = [UIDocumentInteractionController interactionControllerWithURL:url];
        docInteration.UTI = @"com.adobe.pdf";
        docInteration.delegate = self;
        [docInteration presentPreviewAnimated:YES];
}

-(void)documentInteractionControllerDidEndPreview: (UIDocumentInteractionController *)controller{
    [self.navigationController dismissViewControllerAnimated:NO completion:nil];
}

- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller{

    UIViewController * vc = [[UIViewController alloc]init];
    [self.navigationController presentViewController:vc
                                            animated:YES
                                          completion:^{
                                              //This is ran once the document animation has completed
                                          }];
    return vc;
}

Hope this helps.
Luke

mylogon
  • 2,772
  • 2
  • 28
  • 42