I am trying to implement pretty much the simplest case of binding a NSTableView to a NSArrayController, so that the NSTableView is backed by an NSArray.
Here is the setup:
- I have an NSArrayController whose 'Content Array' is bound to an NSArray in my app delegate.
- In 'Object Controller' of the NSArrayController, the class name is set to Model, the type of objects contained in the NSArray.
- The 'Value' of the single column of the NSTableView is bound to key 'name' of 'arrangedObjects' of the Array Controller, which is the only field of the Model class.
- In applicationDidFinishLaunching: of my app delegate, I initialise the NSArray, and insert some Model objects.
However, the rows corresponding to Model do not appear in the table unless I also do: [self.arrayController setContent: self.array]
.
Is there a way I can get this to work using bindings wired up in Interface Builder? I would have expected the fact that the NSArrayController's 'Content Array' is bound directly to the NSArray to mean that I wouldn't have to set the content programmatically. Knowing why would help me understand bindings better.