How to access QuickLook plugin resources?

My QuickLook module generates an HMTL preview for the document. I need to display images saved in a plugin bundle. Just using a method imageNamed:to get an instance of a class NSImagedoes not work. How can this be achieved? Is this a consequence of the fact that

Quick Look generators are designed as CFPlugIn packages.

as the documentation says?

+5
source share
2 answers

Inside the plugin, you can access your CFBundle plugin:

QLThumbnailRequestGetGeneratorBundle or QLPreviewRequestGetGeneratorBundle

, , URL- , :

CFBundleCopyResourceURL

+4

+ imageNamed: + mainBundle NSBundle. .

, :

NSString * path = [[[NSBundle bundleForClass:[MyPluginClass class]] pathForResource:@"MyImage" ofType:@"tif"];
NSImage * image = [[[NSImage alloc] initWithContentsOfFile:path] autorelease];

, .: -)

+7

All Articles