美文网首页
UIDocumentInteractionController

UIDocumentInteractionController

作者: 某天天 | 来源:发表于2018-06-11 15:07 被阅读0次
UIDocumentInteractionController  * documentInteraction = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:kXmlFilePath]];
documentInteraction.delegate  = self;
// 支持文件类型,这里不说明就代表能打开所有文件的App!
documentInteraction.UTI = @"public.xml"; 
// 预览分享
[documentInteraction presentPreviewAnimated:YES];
#pragma mark - UIDocumentInteractionControllerDelegate
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
    return self;
}
- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
{
    return self.view;
}
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
{
    return self.view.frame;
}

相关文章

网友评论

      本文标题:UIDocumentInteractionController

      本文链接:https://www.haomeiwen.com/subject/yrnjjftx.html