views:

12

answers:

1

So assume there's a class which contains:

int someData[EXTREMELY_LARGE_CONSTANT];

What's the simplest way to bind arbitrary integers from this array to textfields in Interface Builder? Can I somehow read/write someData[x] through a KVC method on the class, or do I have to make a textfield subclass or something similar?

A: 

Make the textfield's tag the same as the corresponding int's index. In your action method, get the view's tag and set the corresponding int to the text field's intValue. There's no way to do this with KVC, because an int array is not an object (and in fact is barely a coherent entity even from the perspective of C), so it's completely opaque to the KVC machinery.

Chuck