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;
}
雖然這工作,或至少不會崩潰,我只是得到一個動畫的「正在載入」屏幕。該文檔非常小,正如您可以從位於項目中的代碼示例中看到的那樣,所以不應該花費任何時間來加載。
我哪裏錯了?