I have a question
See also the follow-up: And an answer: What to do if your table view shows the whole array in every row.
Normally, on this blag, I give answers.
This time, I have a question.
Here’s my problem:
Each column’s value
binding is bound to an NSArrayController
; each array controller’s contentArray
binding is bound to a property of my application delegate; each property’s value is an NSArray
of NSString
s.
The Keys column correctly has one of its strings in each row. The Values column incorrectly has its array in every row. This is the problem that has stumped me.
The object class is NSString
in both array controllers. There’s no Core Data in this app.
I have 12-tuple-checked the bindings in IB; they are the same between the two array controllers and between the two table columns.
The accessors are automatically generated by my accessor-generator services. Even so (having added some debug logging previously), I double-checked them, and they are the same.
I have logged the contents of both arrays in my setters. Both arrays are arrays of strings, and both contain the same number of strings.
This problem manifests on both Tiger and Leopard.
Here are screenshots of my Bindings Inspectors:
Each screenshot has two Inspectors superimposed on each other, with the upper Inspector set to half opacity; the result is that pixels that are the same look normal, whereas pixels that differ look ghostly. For your ease of reading, I knocked out the parts that differ and staggered them, so you don’t have to try to make out ghostly text.
Any suggestions?
December 8th, 2007 at 22:51:46
assuming I’m reading this right…
you can’t have simple arrays of strings as the content of an array controller. it doesn’t work. You need to have an array of objects of some sort that have an attribute, even if they’re just NSDictionaries with a single attribute called “string”.
December 8th, 2007 at 23:23:34
Scott: Your comment, as well as an answer suggested earlier by David (that we had both dismissed!), led me down the right path. My next post will explain what the problem was. You’re really close; thank you. ☺