I'm trying to create a window in this style:
I have the following code, but I just get a back background. I guess it can't find the image.
var win = [[NSWindow alloc] init]
[win setFrame:NSMakeRect(0, 0, 320, 200) display:false]
[win setBackgroundColor:[NSColor colorWithPatternImage:[NSImage imageNamed:@"background.png"]]];
I'm writing this for a Sketch App plugin so I have to use Cocoascript. My plugin structure looks like
myplugin.sketchplugin/
Contents/
Sketch/
app.js
manifest.json
Resources/
background.png
I'm neither sure where to put the background image or how to reference it. Would it have to be in manifest.json? Under which key?
(I don't use Sketch so this is untested)
Here is an example how to load
World.pdf
that resides in theResources
folder.It basically does this:
So if
[plugin urlForResourceNamed:"World.pdf"]
does the job I suspect that[plugin urlForResourceNamed:"background.png"]
should also.