首页 > 代码库 > UIDocumentInteractionController 文件预览
UIDocumentInteractionController 文件预览
//创建并从底部弹出来
- (void)viewDidLoad
{
[superviewDidLoad];
[selfsetupDocumentControllerWithURL:fileURL];
CGRect rect =CGRectMake(0,0, ScreenWidth,ScreenHeight);
// [self.docInteractionController presentOptionsMenuFromRect:rect inView:self.view animated:YES];//包含快速预览菜单
[self.docInteractionControllerpresentOpenInMenuFromRect:rect inView:self.viewanimated:YES];//不包含包含快速预览菜单
}
// 创建
- (void)setupDocumentControllerWithURL:(NSURL *)url
{
if (self.docInteractionController ==nil){
self.docInteractionController = [UIDocumentInteractionControllerinteractionControllerWithURL:url];
self.docInteractionController.delegate =self;
}
else{
self.docInteractionController.URL = url;
}
}
#pragma mark - UIDocumentInteractionControllerDelegate
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)interactionController{
return self;
}
//不显示copy print
- (BOOL)documentInteractionController:(UIDocumentInteractionController *)controller canPerformAction:(SEL)action{
return NO;
}
- (BOOL)documentInteractionController:(UIDocumentInteractionController *)controller performAction:(SEL)action{
return NO;
}