Re: Bindings & Reverting Properties
Re: Bindings & Reverting Properties
- Subject: Re: Bindings & Reverting Properties
- From: Quincey Morris <email@hidden>
- Date: Fri, 21 Aug 2009 09:31:35 -0700
On Aug 21, 2009, at 06:27, Dave Keck wrote:
- (void)setHappy: (BOOL)newHappy
{
happy = newHappy;
if (![self save])
self.happy = !happy; // Revert to the old value. Pretend the
recursive call wouldn't
attempt //
another save and cause a stack overflow and crash. It just needs
// to revert the value while
sending
the appropriate KVO notifications.
}
What led you to believe you needed to call the setter recursively? All
you need is:
- (void)setHappy: (BOOL)newHappy
{
happy = newHappy;
if (![self save])
happy = !happy;
}
_______________________________________________
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