UIDocumentInteractionControllerDelegate检查何时加载文档

时间:2015-11-20 06:31:06

标签: ios uidocumentinteraction

在预览中完全加载文档时,会调用UIDocumentInteractionControllerDelegate的哪个委托功能? 只是分享,我已经尝试过了:

- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller  

当我们关闭预览时会调用它。

1 个答案:

答案 0 :(得分:2)

这是一个很好的解决方法,因为据我所知,在文档中似乎没有这样的完成处理程序。

-(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;
}

希望这有帮助。
路加