I have a number of UIButtons and I'm setting a custom font on them programmatically, like this:
Button1.titleLabel.font = [UIFont fontWithName:@"myCustomFont" size:16];
Button2.titleLabel.font = [UIFont fontWithName:@"myCustomFont" size:16];
Button3.titleLabel.font = [UIFont fontWithName:@"myCustomFont" size:16];
Button4.titleLabel.font = [UIFont fontWithName:@"myCustomFont" size:16];
Button5.titleLabel.font = [UIFont fontWithName:@"myCustomFont" size:16];
Button6.titleLabel.font = [UIFont fontWithName:@"myCustomFont" size:16];
This code is correct and it works, but it doesn't seem like the leanest way of writing it. Is there a way to loop through these elements instead?
I had imagined something like this:
for (int i = 1; i <= 5; i++) {
Button(i).titleLabel.font = etc.. // How would I get the value of 'i'?
}
Or is this simply a bad idea?