【问题标题】:quicklook not showing image but has right dataquicklook 不显示图像但有正确的数据
【发布时间】:2013-09-18 17:27:12
【问题描述】:

我正在使用 quicklook 预览本地保存的图像。当我运行该应用程序时,quicklook 读取正确的文件并具有正确的图像内存,但不预览它。它向我展示了这样的东西。

在我的代码中,我将一个 NSURL 传递给这个委托方法

(id)previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)idx 所以我想一切都准备好了。但我还能错过什么?

编辑: 通过以下方式创建路径:

filePath = [NSString stringWithFormat:@"%@/LeBaccPictureDownloadedTemperoraly", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]];

在我提到的委托方法中,我通过以下方式返回 url:

[NSURL fileURLWithPath:filePath];

【问题讨论】:

  • 显示您创建本地 URL 的代码。你用urlWithString:吗?试试 [NSURL fileURLWithPath: path]。
  • 请找到上面的代码
  • filePath = [@"~/Documents/LeBaccPictureDownloadedTemperoraly" stringByExpandingTildeInPath]; 有什么改变吗?文件有扩展名吗?尝试在 UIImageView 中显示文件以确保文件没有损坏。
  • 我错过了文件格式:/将其添加为答案以将其选为正确的格式。非常感谢!

标签: ios objective-c quicklook


【解决方案1】:

文件路径 = [@"~/Documents/LeBaccPictureDownloadedTemperoraly" stringByExpandingTildeInPath];改变什么?文件有扩展名吗?尝试在 UIImageView 中显示文件以确保文件没有损坏。什么文件格式xD

像这样?

【讨论】:

    猜你喜欢
    • 2020-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-28
    • 1970-01-01
    • 2020-11-16
    • 2021-01-25
    • 1970-01-01
    相关资源
    最近更新 更多