Hi! Is it possible to bind a two dimensional array like this
property myArray : {{"A -> B","aaa","bbb"},{"A -> C","aaa","ccc"}}
to a table view with 3 columns?
Hi! Is it possible to bind a two dimensional array like this
property myArray : {{"A -> B","aaa","bbb"},{"A -> C","aaa","ccc"}}
to a table view with 3 columns?
I suspect you’ll need an array of records/dictionaries.
. and preferably an NSArray of NSDictionaries.
Unless you want it editable, in which case you’d want an NSMutableArray of NSMutableDictionaries. Which is what a list of records will be treated as.
awado,
Be extremely careful about these points, as you will mix two different structures through the ASOC bridge :
Note for Shane,
Ric and me have spend a lot of time to solve these problems, especially with NSTableView bindings: an AS record declared as property and whose keys were bound in IB raised a non-KVO compliance error, because ASOC bridges AS record to a Cocoa NSDictionary, which is non-mutable. I had to initialize a NSMutableDictionary, using the AS record, to make things work in the interface.
Regards,
I’m not sure what you mean – the example in chapter 6 of my book use a list of records. But you may have problems if you don’t use an array controller, and when you make changes, the records get changed to mutable dictionaries anyway.
Shane,
We did use an array controller. I had my AS record declared as property, bound via an array controller, and when this record was changed (by file operations) I got an error saying the record had been changed without sending the appropriate notification (to the key value notification center).
I tried to put “MY” before the references, but it didn’t work.
Maybe there was an error elsewhere, but as soon I replaced the record by a mutable dictionary, everything suddenly worked like magic.
Anyway, I learned that it’s always better to do things the more Cocoa-manner as possible when bindings are involved.
Regards,