Comment

Comment by wlue

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).
parent wlue 14 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton