• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bindings & Reverting Properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Bindings & Reverting Properties
      • From: Dave Keck <email@hidden>
    • Re: Bindings & Reverting Properties
      • From: Ken Thomases <email@hidden>
References: 
 >Bindings & Reverting Properties (From: Dave Keck <email@hidden>)

  • Prev by Date: Re: CoreData: Using to-may relationships in fetch request predicates
  • Next by Date: Re: Replace NSScroller instances in NSScrollView?
  • Previous by thread: Re: Bindings & Reverting Properties
  • Next by thread: Re: Bindings & Reverting Properties
  • Index(es):
    • Date
    • Thread