Define a IBOutletCollection
:
@property (nonatomic, strong) IBOutletCollection(UIButton) buttons;
Now connect all your buttons to this collection.
You can now accessing the buttons by:
[self.buttons enumerateObjectsUsingBlock:^ (UIButton* button, NSUInteger index, BOOL* stop) {
//Do stuff here
}];
I must warn you against making assumptions about the order of the buttons inside the array. It is better to give each button a tag, and then in the action method decide which code path to take according to their tag.