Re: Prevent transient attributes to mark the database as dirty ?
Re: Prevent transient attributes to mark the database as dirty ?
- Subject: Re: Prevent transient attributes to mark the database as dirty ?
- From: Fritz Anderson <email@hidden>
- Date: Fri, 2 Jun 2006 10:42:21 -0500
On 31 May 2006, at 6:33 AM, Eric Morand wrote:
- (void)setBalance:(NSDecimalNumber *)value
{
if ( balance != value )
{
[self willChangeValueForKey:@"balance"];
[balance release];
balance = [value retain];
[self didChangeValueForKey:@"balance"];
}
}
Note that I NEED the willChange... and didChange... calls because I
want the changes to this attribute to be notified to KVO observers.
Note also that these two calls are responsible of the dirtiness of
the database.
I think you'll find that you don't need the {will,did}Change calls.
The KVC mechanism brackets KVC set accessors with notifications to
observers.
-- F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden