Reputation: 13
Is there a simple way to bind a NSMutableArray made up of Strings to a Single column NSTableView without creating any new classes?
Upvotes: 0
Views: 440
Reputation: 21373
Assuming you're using a view-based NSTableView, you must bind the entire table view (not the column) to the array controller's arrangedObjects. Then, bind the text field's value
to the containing cell view's objectValue
property.
This is documented here.
For cell-based NSTableViews, Amy Worrall's answer is the correct approach.
Upvotes: 1
Reputation: 16337
Make an NSArrayController in interface builder. Bind its Content Array to your mutable array, like so:
Then bind your table column to that array controller, like so:
(Note the self
in the model key path field. That's what makes it work with an array of strings.)
Upvotes: 2