• 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: Self KVO...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Self KVO...


  • Subject: Re: Self KVO...
  • From: Randy Widell <email@hidden>
  • Date: Thu, 09 Oct 2014 21:21:40 -0700

> On Oct 9, 2014, at 21:13, Ken Thomases <email@hidden> wrote:
>
> On Oct 9, 2014, at 10:56 PM, Randy Widell <email@hidden> wrote:
>
>> I’m not sure I am having a hard time figuring this out and I am just not finding anything via Google.  I am writing a NSTextFieldCell subclass and I want to recalculate the size whenever the string value changes via a binding.  What I can’t seem to figure out is how to observe the change.  I could register each instance with itself for change notifications, but that just seems like an odd way to go about it.  Seems like it should be possible to just override setValue:forKeyPath:, but that never seems to be called.
>
> I would expect that the control will call -setObjectValue: on the cell when it (the control) receives a new value via the binding.
>
> It may not be the case that the control ever gets -setValue:forKey: when the property to which it is bound changes.  That's one possible way for the implementation to work, but as least as likely is for the control to have -observeValueForKeyPath:… to be called on it because it was using KVO to observe the property to which it is bound.
>
> In any case, the cell should be entirely insulated from the way in which the control received its new value.  When implementing a cell, you should not need to care about bindings or whatever.
>
> Regards,
> Ken
>

Oh, man, thanks.  I knew it had to be something straightforward.  Yeah, the whole KVO route seemed like a weird way to go about it.  Went down the wrong rabbit hole.  Thanks!
_______________________________________________

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


References: 
 >Self KVO... (From: Randy Widell <email@hidden>)
 >Re: Self KVO... (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Scaling an NSImage to have exact pixel dimensions
  • Next by Date: Re: Scaling an NSImage to have exact pixel dimensions
  • Previous by thread: Re: Self KVO...
  • Next by thread: XPCService not getting launched from app
  • Index(es):
    • Date
    • Thread