UIDocumentInteractionController
初始化对象网上有资料说要用这个属性要用retain,我也不知道为啥........
实现的代理方法源码:
1.引入协议<UIDocumentInteractionControllerDelegate>
2.初始化,签代理
_doc = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filePath]];
_doc.delegate = self;//设置代理
[self.doc presentPreviewAnimated:YES];
presentPreviewAnimated:YES,弹出预览窗口
presentOptionsMenuFromRect:inView:animated;不弹出预览窗口,直接弹出菜单(还有很多方法)
3.实现代理方法
#pragma mark -------------documentDelegate---------
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller {
return self;
}
- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller {
return self.view;
}
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller {
return self.view.frame;
}
网友评论