Changing the value of an NSImageView when it is edited via the control
Posted
by Septih
on Stack Overflow
See other posts from Stack Overflow
or by Septih
Published on 2010-06-15T11:09:11Z
Indexed on
2010/06/15
11:12 UTC
Read the original article
Hit count: 353
editable
|nsimageview
Hello,
I have an NSImageView which is set to editable. I would like to be able to revert to a default image when the user deletes the image. I've tried changing the value that the NSImageView is bound to in the setter, but the getter is not called afterwards, so the NSImageView is blank, despite the bound value being set to another image. Here is the setter code:
-(void)setCurrentDeviceIcon:(NSImage *)newIcon {
[self willChangeValueForKey:@"currentDeviceIcon"];
if(newIcon == nil)
newIcon = [currentDevice defaultHeadsetIcon];
currentDeviceIcon = newIcon;
[self setDeviceChangesMade:YES];
[self didChangeValueForKey:@"currentDeviceIcon"];
}
How should I make the NSImageView update it's value?
Thank You.
© Stack Overflow or respective owner