Re: NSImage imageNamed
Re: NSImage imageNamed
- Subject: Re: NSImage imageNamed
- From: Tom Waters <email@hidden>
- Date: Sun, 8 Jul 2001 10:26:52 -0700
Hmmm... are you sure that the imageNamed image is autoreleased? I mean,
I realize it should be since it is a static factory method, but boy, if
it is, now I'm REALLY confused. I hadn't retained any of the three
images that I'm compositing all over my app, yet it never ever
crashed... just dumb luck? Although I checked, and now everywhere in my
code, (after many times through the runloop, the retain count is now
2... doesn't seem right.
In any event, I added the retain, and it didn't change the original
behavior I was asking about.
I guess the question is, does imageNamed BLOCK until the image is fully
loaded and ready to paint? or is it asynch in any way at all?
I note that if you load an image from an url, you have to call
loadInForeground to get it to be synchronously loaded...
On Sunday, July 8, 2001, at 09:42 AM, Kyle Mandli wrote:
I use this function a lot and I don't seem to have any problems with it
although make sure you are retaining it correctly. You will need to do
something to this affect...
NSImage *myImage = [[NSImage imageNamed:@"image.jpg"] retain];
I usually create the instance in initWithFrame: and it seems to work
there.