Q:

Create a group of UIButtons?

I have a project that contains 35 identical buttons (with black background and gray border) located one beside the other (5 in the first row, then five more in the bottom, fill up my whole screen of iphone). 
The way in which I am putting the edges is:
    button1.layer.borderWidth = 1.0f;
    button1.layer.borderColor = [[UIColor grayColor] CGColor];

    button2.layer.borderWidth = 1.0f;
    button2.layer.borderColor = [[UIColor grayColor] CGColor];

    button3.layer.borderWidth = 1.0f;
    button3.layer.borderColor = [[UIColor grayColor] CGColor];

    ....

    button35.layer.borderWidth = 1.0f;
    button35.layer.borderColor = [[UIColor grayColor] CGColor];

Imagine how many lines of code were repeated and that to me does not mean a good thing, in this case would like to know how can I minimize it? it is possible to group all the buttons in one?

A:

Create a..
@property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *buttonCollection;

and connect all your buttons to this.
Then define your attributes in your user interface like this (screenshot is of my buttons, so set your properties how you wish)

Or cycle through your buttonCollection with this..put this in your viewDidLoad
for(UIButton *button in buttonCollection){
            //capture frame
            button.layer.borderWidth = 1.0f;
            button.layer.borderColor = [[UIColor grayColor] CGColor];
}

