Mc Mc
Mc Mc

Reputation: 103

Set custom font as default in iphone programming

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?

Upvotes: 5

Views: 2477

Answers (2)

Steve
Steve

Reputation: 31642

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

Upvotes: 2

Maximilian Litteral
Maximilian Litteral

Reputation: 3089

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.

Upvotes: 1

Related Questions