• 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: Custom Cell Bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom Cell Bindings


  • Subject: Re: Custom Cell Bindings
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 03 Sep 2011 19:23:17 -0700

On Sep 2, 2011, at 17:12 , Seth Willits wrote:

> Say I have a custom NSCell subclass (or maybe NSActionCell) which implements some custom UI for manipulating some immutable value type which I can't use any of the standard cell subclasses for. If this cell is the data cell in a table column, binding the column's content to an array controller gets the values to the custom cell and they're displayed correctly. Easy peasy.
>
> What I can't figure out for the life of me is how to change the value in the cell and get that change back into the original array. If the object is mutable and you're changing some property of it, that's straightforward, but how do you change the entire value if it's immutable? NSCell has a "value" binding, which I thought maybe would be bound to something, but it's not.
>
> As far as I can tell, there's no way to change the object value of the cell and reflect the change in the array controller's content.

OK, I went back to your original post, and I think I understand what you said now.

The answer, though, is still, "You can't, but you don't have to."

The NSCell goes only as far as replacing its own "objectValue" with the new/edited value. From there, it's the table view's job to propagate the new object value back to the data model.

So, how is the propagation triggered? I believe the answer lies in the fact that table views *require* their column cells to be NSActionCell subclasses. Arbitrary NSCell subclasses don't work. If the NSCell is actually a NSActionCell, it makes sense for it to issue 'sendAction:to:' to the owning control when it replaces its own object value (even if the action is nil, which again I think is something that Ken verified).

This means that the owning table view knows when the cell value is replaced, and it can then use either the table column binding or the data source to figure out how to get the new value back into the data model.

Assuming that's technically accurate, is it a more relevant response to your question?


_______________________________________________

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: Custom Cell Bindings
      • From: Seth Willits <email@hidden>
References: 
 >Custom Cell Bindings (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: Custom Cell Bindings
  • Next by Date: Re: Custom Cell Bindings
  • Previous by thread: Re: Custom Cell Bindings
  • Next by thread: Re: Custom Cell Bindings
  • Index(es):
    • Date
    • Thread