UIDocumentInteractionController 文件预览
//創(chuàng)建并從底部彈出來
- (void)viewDidLoad
{
? ? [super viewDidLoad];
[self setupDocumentControllerWithURL:fileURL];
? ? CGRect rect = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
//? ? [self.docInteractionController presentOptionsMenuFromRect:rect inView:self.view? animated:YES];//包括高速預(yù)覽菜單
? ? [self.docInteractionController presentOpenInMenuFromRect:rect inView:self.view animated:YES];//不包括包括高速預(yù)覽菜單
}
// 創(chuàng)建
- (void)setupDocumentControllerWithURL:(NSURL *)url
{
? ? if (self.docInteractionController == nil){
? ? ? ? self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL: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;
}
總結(jié)
以上是生活随笔為你收集整理的UIDocumentInteractionController 文件预览的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 讨论MySQL丢失数据的几种情况
- 下一篇: flask中的信号机制