Changing iOS Font on All Widgets (UILabel, UIButton, etc.)

Screen Shot 2014-01-09 at 2.39.56 PMSometimes it’s necessary to change the font on an app and you don’t want to go into Interface Builder and manually change them all. Ug.

So you can recursively call a method to change the font on all subviews that respond to the setFont: method.

  1. Check that it responds to the selector and call it. Use ‘performSelector:’ b/c UIView doesn’t respond to setFont: so this avoids warnings.
  2. Set the color (if one is passed in).
  3. UIButtons ‘font’ color method is based on title
  4. There may be other controls you may have to handle differently.
  5. Do the same on all subviews to cover them all.