mag*_*gix 8 ios qlpreviewcontroller
我正在尝试使用QLPreviewController显示文件.QL视图正确显示(被推送到我的导航控制器顶部)但内容为空白.但是,不会显示任何错误,应用程序也不会崩溃.检查文件是否存在返回true.(一个证据是,如果我使用[self.docInteractionController presentPreviewAnimated:YES];docInteractionController UIDocumentInteractionController是正确显示的文件).
代码直接取自Apple示例代码DocInteraction.
previewController.dataSource = self;
previewController.delegate = self;
// start previewing the document at the current section index
previewController.currentPreviewItemIndex = 0; //I want the first (and only) document
[[self navigationController] pushViewController:previewController animated:YES];
[previewController release];
Run Code Online (Sandbox Code Playgroud)
当前视图是a QLPreviewControllerDataSource, QLPreviewControllerDelegate,,委托方法如下:
- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller
{
return self.documentURLs.count;
}
- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex: (NSInteger)index
{
return [self.documentURLs objectAtIndex:index];
}
Run Code Online (Sandbox Code Playgroud)
documentURLs是一个包含文档的fileURL的NSArray.相同的fileURL UIDocumentInteractionController正确传递给显示器.我不一定要使用QuickLook,我可能只是依赖于UIDocumentInteractionController,但事实上它不起作用真的很烦人.
先感谢您
乔瓦尼
| 归档时间: |
|
| 查看次数: |
1674 次 |
| 最近记录: |