Hacker News new | ask | show | jobs
by wlue 4937 days ago
A strategy that I found works really well to quickly style everything is to create a category on UIView that defines a block property decorated with UI_APPEARANCE_SELECTOR, then on the setter, invoke the block. Then set the appearance proxy on app startup:

  [[UILabel appearance] setStyleBlock:^(id view) {
    UILabel *label = view;
    label.backgroundColor = [UIColor clearColor];
  }];
The advantage is that you can style properties that aren't supported by UIAppearance natively, since a block just gets run when the view is ready to be styled. You also can style subviews from the same block (ie. title label inside of a warning view should be red and bold).