Re: ImageNamed not refreshing
Re: ImageNamed not refreshing
- Subject: Re: ImageNamed not refreshing
- From: "John C. Randolph" <email@hidden>
- Date: Thu, 3 Oct 2002 11:48:14 -0700
On Tuesday, October 1, 2002, at 05:30 AM, Joe Zobkiw wrote:
But, your copy method is a safer and cleaner solution. Just make sure
you
release the old one when you're done with it. Don't just reassign the
pointer to a new copy or you'll have a memory leak.
Thanks Brock,
It seems like an autorelease might do the trick. Since I am immediately
assigning theImage to the NSImageView I presume it will retain it.
Therefore, I've done the following which seems to do the trick:
NSImage *theImage = [[[NSImage imageNamed:@"picture.tiff"] copy]
autorelease];
[m_imageView setImage:theImage];
[m_imageView setNeedsDisplay:YES];
Thanks for your input. Even though I "figured it out" it helps to have
someone reaffirm your solution. Thanks!
That could also be:
[m_imageView setImage:[NSImage imageNamed:@"picture.tiff"]];
The -setNeedsDisplay is redundant, since NSImageView will do that by
itself.
-jcr
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.