Re: Re: kvc/kvo for arrays defeated me.
Re: Re: kvc/kvo for arrays defeated me.
- Subject: Re: Re: kvc/kvo for arrays defeated me.
- From: email@hidden
- Date: Sat, 14 Mar 2009 03:15:39 +0000
Oh ok I understand. Thanks!
I have one last question about this stuff. In the attributes panel for an
array controller, there is a field called Object Controller Class Name. The
tool tip says to set this to the class that will serve to add new objects
to the controller's managed array. This more or less makes sense, but I
just wanted to be sure.
If my array controller was managing an array of Widget objects, would i set
this field to Widget?
On Mar 13, 2009 7:57pm, Kyle Sluder <email@hidden> wrote:
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