本文介绍了获取文件的QuickLook预览图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以获取文件的快速预览图像?
Is there any way to get the quick look preview image for a file?
我正在寻找这样的东西:
I'm looking for something like this:
NSImage *image = [QuickLookPreviewer quickLookPreviewForFile:path];
推荐答案
请参阅文档中的QLThumbnailRequest
: https://developer.apple.com/library/mac/#documentation/UserExperience/Reference/QLThumbnailRequest_Ref/Reference/reference.html
NSURL *path = aFileUrl;
NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kQLThumbnailOptionIconModeKey];
CGImageRef ref = QLThumbnailImageCreate(kCFAllocatorDefault, (CFURLRef)path, CGSizeMake(600, 800 /* Or whatever size you want */), (CFDictionaryRef)options);
这篇关于获取文件的QuickLook预览图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!