I’m trying to find a way to link an array controller to an Array. I know via an outlet I can fill textfields and even tableviews in the .xib file made with Interface Builder.
I was hoping it would be possible to have one easy outlet (NSArray) and put it into an Array Controller. In turn, a table will link its contentfield to the stuff in the Array. Is this possible or am I just thinking too much non-cocoa?
Right now I have an Object Reference in Interface builder which already passes through a pair of fields and some action handers to buttons. If I try to link the Array Controller to the outlet ‘FilesArray’ I can only link it to the Object itself, not its outlets.
I’m only a beginner so I don’t see why this wouldn’t be possible?
thanks!
You just need to go to the Bindings Pane in the Interface builder inspector and under the ‘Controller Content’ for a NSArrayController you need to bind to the array you want. Then you can just bind the NSTableColumn to the NSArray Controller.
See With and Without Bindings for an example of using NSArrayController.
Also CocoaDev gives some more precise instructions on using NSArrayController and using it with TableViews http://www.cocoadev.com/index.pl?NSArrayController