Re: Array controller?
Re: Array controller?
- Subject: Re: Array controller?
- From: Robert Goldsmith <email@hidden>
- Date: Mon, 19 Apr 2004 15:23:06 +0100
>
I have a NIB which contains an NSTable, an NSArrayController, and the
>
model object (which provides the array).
>
>
How to bind the NSArrayController to the array? Its Binding > Content
>
array allows me to set only Shared user default, File's owner and
>
Shared application, none of which I want... the model object happens to
>
be inside the NIB, instantiated there?
You need to connect the controller's Content outlet to the object that
provides the array then set the controllers contentArray binding Modal
Key Path to the name of either the array variable instance in the model
object or the name of the 'get' method in the object.
To bind the table cells to the controller, you need to do it column by
column, you can't do it for the whole table at once.
To move through the array, use the selectNext and selectPrevious
actions on the controller. To see if you can move forward or backwards,
use the canSelectNext and canSelectPrevious bindings on the controller.
The observers seem not to catch every way by which you can update the
array so if you will be modifying the array rather than just moving
through it, access the array through get and set methods only and use
the name of the get method when binding and a set method with set
prefixing the get method name e.g. guiArray and setGuiArray
Hope this all works :)
Personally, since getting the hang of controllers I don't know how we
could have blindly gone to so much effort by hand before! They save so
much work!
Robert
---
GnuPG public key:
http://www.Far-Blue.co.uk/
[demime 0.98b removed an attachment of type application/pgp-signature which had a name of PGP.sig]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.