I want to keep custom fonts in iOS app. Currently, I\'m using iOS default fonts. Is there any possible way for the same?
How do I include the custom font so that I c
Ok, from all the other answers you are now very well familier that how to add a custom font (other than iOS default font) into app.
So now what? One thing is still remaining, I'm not sure if you want to use the same size custom font everywhere. If so,
I'm using this way to have custom font in my app.
If your app will have a single custom font then you can use it like this way for entire app.
#define appFontBold(x) [UIFont fontWithName:@"CustomFont-Bold" size:x]
#define appFontLight(x) [UIFont fontWithName:@"CustonFont-Light" size:x]
#define appFontRegular(x) [UIFont fontWithName:@"CustonFont-Regular" size:x]
I've added these macros globally (so can access it from anywhere)
and you can use it like this, yourLabel.font = appFontRegular(12);
or yourTextField.font = appFontBold(14);
this helps you in following situations,
[UIFont fontWithName: size:]
; everywhere.If your app will have more than one custom font then you can use it like this way for entire app.
then also you can define different macros like this,
Then above macro will be the same (as this is the maximum used fonts in app), for other fonts :
#define appFontBoldOtherFont(x) [UIFont fontWithName:@"CustomOtherFont-Bold" size:x]
#define appFontLightOtherFont(x) [UIFont fontWithName:@"CustonOtherFont-Light" size:x]
#define appFontRegularOtherFont(x) [UIFont fontWithName:@"CustonOtherFont-Regular" size:x]