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
imageNamed:
NSImage
Quick Look generators are designed as CFPlugIn packages.
as the documentation says?
Inside the plugin, you can access your CFBundle plugin:
QLThumbnailRequestGetGeneratorBundle or QLPreviewRequestGetGeneratorBundle
, , URL- , :
CFBundleCopyResourceURL
+ imageNamed: + mainBundle NSBundle. .
, :
NSString * path = [[[NSBundle bundleForClass:[MyPluginClass class]] pathForResource:@"MyImage" ofType:@"tif"]; NSImage * image = [[[NSImage alloc] initWithContentsOfFile:path] autorelease];
, .: -)