Re: kvc/kvo for arrays defeated me.
Re: kvc/kvo for arrays defeated me.
- Subject: Re: kvc/kvo for arrays defeated me.
- From: Kyle Sluder <email@hidden>
- Date: Fri, 13 Mar 2009 22:57:33 -0400
On Fri, Mar 13, 2009 at 10:04 PM, Darren Minifie <email@hidden> wrote:
> Kyle what do you mean by binding
> the table view's content property? I understand what you mean, but I'm
> unsure of what I should bind it to. The array controller's array? or the
> tableView's dataSource?
Well I assume you're not using a data source since you're using bindings.
The column bindings are, strictly speaking, used only to provide
content for the column's cell when drawing the rows of the table. The
table itself, not its columns, manages its selection, so in order to
coordinate this selection with the controller its own selection
bindings need to be bound to the controller supplying its data.
Binding the table's content binding will take care of these bindings
automatically. If it can figure it out, the table view will also
deduce the object and keypath to use for its content binding from the
columns' value bindings.
So you would normally have something like this:
column1.value -> [myController].arrangedObjects.title
column2.value -> [myController].arrangedObjects.artist
Then the framework will automatically fill in the following bindings:
tableView.content -> [myController].arrangedObjects
tableView.selectionIndexes -> [myController].selectionIndexes
tableView.sortDescriptors -> [myController].sortDescriptors
You can manually specify these three bindings, which is particularly
useful if you need the selection in the table view to be bound to an
array controller completely different from the one(s) providing data
for your column(s).
Also, I see that the NSTableView bindings document has been updated
with more information on to automagic bindings:
http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSTableView.html
Thank you to whoever took care of that one.
--Kyle Sluder
_______________________________________________
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