shared NSImage from bundle
shared NSImage from bundle
- Subject: shared NSImage from bundle
- From: Torsten Curdt <email@hidden>
- Date: Tue, 11 Mar 2008 11:12:46 +0100
While I know I can load an image like this
image = [[NSImagealloc] initWithContentsOfFile:
[[NSBundlemainBundle] pathForResource:@"someimage" ofType:@"PNG"]];
all my NSDocument should be OK to share the same instance. Creating
class level singleton accessors seem a little too much work. Is there
a class level init that could be used to fill class level variables?
Forgive me my blasphemy but something along the lines of...
public class MyDocument extends NSDocument {
private final static NSImage image;
private final static NSImage image2 = ...;
static {
image = ...
}
...
}
How do people usually do this? Sorry, if this turns out to be more a
Objective-C question than a Cocoa question.
cheers
--
Torsten
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden