I have an NSMutableArray of IBOutlet UIImageView elements and I want to bind each individual element of the array to a separate UIImageView defined in my NIB file. While I can bind it to other solitary IBOutlet UIImageView objects, the Interface Builder does not even give me an option to bind to the array or an element of it. I am building a tic tac toe game and want to combine the 9 individual UIImageView “squares” that I have into one array representing the whole board so that I can more elegantly reference the board in code.
Is this even possible? What am I missing?
If you are using iOS 3.0 (as your question’s tag implies), I don’t think you can do it in your nib.
If you are using iOS 4.0 or later, you can do it in your nib. Here’s how.
You need to set up your
NSMutableArrayas anIBOutletCollection, like this:Then you can control-drag from your
ViewController(probably the File’s Owner) to each image view and add it to theimageViewscollection.