• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ImageNamed not refreshing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: ImageNamed not refreshing (From: Joe Zobkiw <email@hidden>)

  • Prev by Date: Re: NSTableView and check boxes (for the hundredth time)
  • Next by Date: Re: NSTableView and check boxes (for the hundredth time)
  • Previous by thread: Re: ImageNamed not refreshing
  • Next by thread: Re: (newbie)sun vs. apple....
  • Index(es):
    • Date
    • Thread