Reputation: 351
How could I change font and colour of text for MULTIPLE Labels (all in one UIViewController
) with one code, without having to make an outlet
for every Label. I'm using storyboards
.
Font has to be changed in code because it is not listed with all the others
Upvotes: 0
Views: 1363
Reputation: 241
You can use an IBOutletCollection
instead of many IBOutlets
.
@property (strong, nonatomic) IBOutletCollection(UIView) NSArray *fontViews;
And then set the fontsize or whatever you want in a loop:
for (UITextView *view in self.fontViews) {
if ([view respondsToSelector:@selector(setFont:)]) {
[view setFont:[UIFont systemFontOfSize:20]];
}
}
Upvotes: 1