ImageNamed not refreshing
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.