by jcampbell1 · 13y ago · 0 comments
#username-label { text-align:right }
#first-name-label { text-align:right }
...
#last-name-label { text-align:right }
#address-label { text-align:right }
With CSS, you get nice things like: #user-form label { text-align: right }
iOS code looks more like the first example but it goes on for hundreds of lines. You can create something like classes by creating real classes, but then you end up with inheritance hell.I find IB's WYSIWYG to be a lesser evil.
for (UILabel *l in @[self.usernameLabel, self.firstNameLabel, …]) {
l.textAlignment = UITextAlignmentRight;
l.textColor = [UIColor redColor];
} +(void)styleLabelForCertainPage:(UILabel *)label {
label.textAlignment = UITextAlignmentRight;
label.textColor = [UIColor redColor];
}
Then run those through your loops. If you're seriously considering writing a lot of lines for something trivial, then you're probably doing it wrong in Objective-C. [[UIToolbar appearance] setTintColor:[UIColor redColor]];