gpt4 book ai didi

ios - iOS应用程序中的空白QLPreviewController

转载 作者:可可西里 更新时间:2023-11-01 03:21:36 24 4
gpt4 key购买 nike

我正在尝试使用 QLPreviewController 显示文件。 QL View 正确显示(被推送到我的导航 Controller 顶部),但内容为空白。但是,不会显示任何错误并且应用程序不会崩溃。检查文件是否存在返回 true。 (一个证明是,如果我使用 [self.docInteractionController presentPreviewAnimated:YES]; 其中 docInteractionController 是 UIDocumentInteractionController 文件正确显示)。

代码直接取自苹果示例代码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];

当前 View 是一个QLPreviewControllerDataSource, QLPreviewControllerDelegate,,委托(delegate)方法如下:

- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller 
{
return self.documentURLs.count;
}

- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex: (NSInteger)index
{
return [self.documentURLs objectAtIndex:index];
}

documentURLs 是一个 NSArray,其中包含文档的 fileURL。传递给 UIDocumentInteractionController 的相同文件 URL 正确显示。我不一定要使用 QuickLook,我可能只依赖 UIDocumentInteractionController,但是它不起作用的事实真的很烦人。

提前谢谢你

乔瓦尼

最佳答案

制作一个演示问题的示例。如果您发现它仍然出现在 iOS 7 上,请提交错误报告。

我报告了这个类的一个错误(传递 nil URL 以获取加载指示器)并在 2 周内得到修复。

关于ios - iOS应用程序中的空白QLPreviewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8009637/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com