5

I'm building an App that requires a custom font. I added the form to my info.plist and I can use it connecting each single object (labels, textviews. table cells.... ) manually to an IBOUtlet and them set the font in the initialization.

Nevertheless this process is long, inefficient and probably bad done.

Could somebody tell me if I can setup a font by default for all the app?

Mc Mc
  • 103
  • 4
  • May I ask if you intentionally used the `iphone-sdk-4.0` tag **specifically**? Or, is iOS5 an option? – Steve Jan 20 '12 at 00:55

2 Answers2

2

In iOS 5 this is easy:

Set a default font for whole iOS app?

Prior to iOS 5 if you're doing this throughout your app, I'd subclass UILabel and apply your changes there.

Throughout your app simply use your subclass instead of UILabel.

Even in interface builder you can do this - just change the "Class" to your custom class in the panel on the right.

enter image description here

Community
  • 1
  • 1
Steve
  • 31,144
  • 19
  • 99
  • 122
  • @McMc Excellent! Yeah... we went that way for pretty much everything just because it's the one sure-fire way of getting total control over every UI element. – Steve Jan 27 '12 at 23:42
1

i don't think this is really possible, but a easy way would just make a IBOutlet for all of the things, then just create a UIFont like UIFont *customFont = [UIFont alloc] init]; and set the font name for that, then just do label.font = customFont; UIButton.title.font = customFont which makes it slightly easier.

Maximilian Litteral
  • 3,059
  • 2
  • 31
  • 41