Frage

I'm loving being able to use an appearance proxy in my iOS5 app to customise the NavigationController UI elements system-wide, however:

I have a lot of nested tables in my app, of which I'd love to be able to change the font across all table cells. They are mainly statically created. I've put some cell generation inside of a class, being read from an array, but the main issue lies with a large contents section I've tabled in Interface Builder. IB doesn't seem to have the option for mass-font setting.

I was wondering if anyone could help me find a way to set all the UITableCell fonts in one go?

Perhaps something like:

[[UILabel appearance] setFont:[UIFont fontWithName:@"Times" size:17.00];
War es hilfreich?

Lösung

You can use appearanceWhenContainedIn: to narrow down which UIViews you'd like to set the appearance for.

In your example, try:

[[UILabel appearanceWhenContainedIn:[UITableViewCell class], nil] 
          setFont:[UIFont fontWithName:@"Times" size:17.00]];

Andere Tipps

Actually, no. It is not valid to use UIAppearance to style a UILabel. See my self-answered question here. It kinda works, but it's not valid, for the reasons outlined over there.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top