Oneiros
Oneiros

Reputation: 4378

XCode 4 - Array Of Buttons

I'm trying to learn the Mac OS and iOs developing with XCode 4. My first application is a game for mac: Reversi (Othello).
I built my interface with a 8x8 grid of green buttons but now i don't understand how to link them in my AppDelegate class. How should i define an array of IBOutlet? I can't create 64 different attributes :D

I read that iPhone developers can use IBOutletCollection but i can't find a way to use it in my mac application...

Upvotes: 1

Views: 1633

Answers (1)

omz
omz

Reputation: 53551

On the Mac, you can simply use one NSMatrix outlet. Create a single button in Interface Builder, then select "Embed in > Matrix" from the "Editor" menu. When you resize the matrix while holding the option (alt) key, it will create a grid of multiple buttons instead of resizing the button itself.

Upvotes: 6

Related Questions