1
我已经在iPad应用程序中实现了UIDocumentInteractionController - 目的是打开从联网位置获取的文档并显示它们。UIDocumentInteractionController - 快速查看永不完成加载文件
网上看,我走了这么远:
-(void)viewDidLoad
{
[super viewDidLoad];
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"test.docx"];
NSLog(@"Path is %@", filePath);
docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filePath]];
docController.delegate = self;
[docController presentPreviewAnimated:YES];
}
- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *)controller
{
return self;
}
- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
{
return self.view;
}
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
{
return self.view.frame;
}
虽然这工作,或至少不会崩溃,我只是得到一个动画的“正在载入”屏幕。该文档非常小,正如您可以从位于项目中的代码示例中看到的那样,所以不应该花费任何时间来加载。
我哪里错了?