5
有什麼辦法可以快速查看文件的預覽圖像嗎?獲取文件的快速查看預覽圖像
我正在尋找這樣的事情:
NSImage *image = [QuickLookPreviewer quickLookPreviewForFile:path];
有什麼辦法可以快速查看文件的預覽圖像嗎?獲取文件的快速查看預覽圖像
我正在尋找這樣的事情:
NSImage *image = [QuickLookPreviewer quickLookPreviewForFile:path];
見QLThumbnailRequest
在docs: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);