• 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
ImageNamed not refreshing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ImageNamed not refreshing


  • Subject: ImageNamed not refreshing
  • From: Joe Zobkiw <email@hidden>
  • Date: Mon, 30 Sep 2002 11:44:00 -0400

Hello All,

I am having a little problem getting an NSImageView to "reset" its image
once I've altered it. Here is what I'm doing (pseudo code):

// Set the image in awakeFromNib
// This works!

NSImage *theImage = [NSImage imageNamed:@"picture.tiff"];
[m_imageView setImage:theImage];
[m_imageView setNeedsDisplay:YES];

// Later on I alter the image in another method calling it like this:
// This works!

[m_imageView setImage:[thePlugin doImageEditing:[m_imageView image]]];
[m_imageView setNeedsDisplay:YES];

- (NSImage*)doImageEditing:(NSImage*)theImage
{
NSRect theRect;
theRect.origin.x = theRect.origin.y = 0;
theRect.size = [theImage size];
[theImage lockFocus];
[[[NSColor lightGrayColor] colorWithAlphaComponent:0.1] set];
NSRectFillUsingOperation(theRect, NSCompositeSourceOver);
[theImage unlockFocus];
return theImage;
}

// The problem is, when I re-execute the first three lines,
// the image never "resets" - shouldn't this reload the image
// from the resource? I tried setting the image cache to
// NSImageCacheNever but that doesn't seem to make a difference.

NSImage *theImage = [NSImage imageNamed:@"picture.tiff"];
[m_imageView setImage:theImage];
[m_imageView setNeedsDisplay:YES];

Any thoughts?

--
Joe Zobkiw
TripleSoft Inc.
email@hidden
_______________________________________________
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.

  • Follow-Ups:
    • Re: ImageNamed not refreshing
      • From: Joe Zobkiw <email@hidden>
  • Prev by Date: Problem calling InternetConfig in Jaguar
  • Next by Date: Re: How come bundle is just compiling as a folder?
  • Previous by thread: Re: Problem calling InternetConfig in Jaguar
  • Next by thread: Re: ImageNamed not refreshing
  • Index(es):
    • Date
    • Thread