UIDocumentInteractionController本地查看文件
- 实例化一个UIDocumentInteractionController对象并遵守其delegate
@interface FileReviewController () <UIDocumentInteractionControllerDelegate>
@property (nonatomic, strong) UIDocumentInteractionController *DIController;
@end
NSURL *urlPath = [[NSBundle mainBundle] URLForResource:@"Jobs" withExtension:@"pdf" subdirectory:@"PDF.bundle"];
self.DIController = [UIDocumentInteractionController interactionControllerWithURL:urlPath];
self.DIController.delegate = self;
#pragma mark - UIDocumentInteractionControllerDelegate
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller {
return self;
}
- (UIView*)documentInteractionControllerViewForPreview:(UIDocumentInteractionController*)controll