Re: Making a bound view re-read its value
Re: Making a bound view re-read its value
- Subject: Re: Making a bound view re-read its value
- From: Quincey Morris <email@hidden>
- Date: Fri, 15 Aug 2008 11:02:06 -0700
On Aug 15, 2008, at 10:23, Adam R. Maxwell wrote:
Sending empty willChange/didChange messages is not a good idea:
http://www.cocoabuilder.com/archive/message/cocoa/2008/5/18/207038
Except that the idea of "non-empty" willChange/didChange messages
doesn't cohere. The following is a perfectly legal setter:
- (void) setX: (NSInteger) newX {
[self willChangeValueForKey:@"x"];
iVarX = newX;
[self didChangeValueForKey:@"x"];
}
When this is called with newX == iVarX, it doesn't do anything except
call willChange/didChange, so it's "empty" in that case, if "empty"
had any meaning here. If there was some problem with "empty" setters,
that scenario would fail. Does setting a property to its current value
fail?
It may well be different for Core Data property setters, though.
IAC, Marcus's alternative is to do this:
object.temperature = object.temperature;
instead of this:
[object willChangeValueForKey:@"temperature"];
[object didChangeValueForKey:@"temperature"];
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden