Re: NSImage imageNamed
Re: NSImage imageNamed
- Subject: Re: NSImage imageNamed
- From: David Remahl <email@hidden>
- Date: Sun, 8 Jul 2001 20:18:25 +0200
Actually, practiacally all + functions that aren't alloc or new
autorelease the object...That includes all the combined alloc/inits.
If you didn't retain them, maybe you didn't use them past the end of the
function you created them in?
/ david
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...
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.
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev