I have a custom font I want to use for everything displaying text in my app, labels, text views etc.
Is there a way to set the default font (labels by default use SystemFont) for the whole app?
I have a custom font I want to use for everything displaying text in my app, labels, text views etc.
Is there a way to set the default font (labels by default use SystemFont) for the whole app?
For Swift 4
All the above answers are correct but i have done in little different way that is according to device size. Here, in ATFontManager class, i have made default font size which is define at the top of the class as defaultFontSize, this is the font size of iphone plus and you can changed according to your requirement.
I have added certain font name, for more you can add the font name and type here.
This class refers to device detector in order to provide appropriate font size according to device.
How to use. Hope it will help.
We have achieved the same in Swift -Xcode 7.2 using Parent View Controller and Child view controller (Inheritance).
File - New - Cocoa Touch class - ParentViewController.
Make child view controllers and associate with a StoryBoard VC, add a textLabel.
OR Make a custom UILabel Class(Sub classing method) and associate required labels to it.
Note: The Font and colour declared in Parent VC are implemented in CustomFontLabel . The advantage is we can alter the properties of uilabel/any view all together in some simple changes in Parent VC.
2)'for' looping UIView for sub views. It works only on a particular VC.
For Xamarin.iOS inside AppDelegate's
FinishedLaunching()
put code like this :-set font for the entire application and Add '
UIAppFonts
' key on Info.plist , the path should be the path where your font file .ttf is situated .For me it was inside 'fonts' folder in my project.None of these solutions works universally throughout the app. One thing I found to help manage the fonts in Xcode is opening the Storyboard as Source code (Control-click storyboard in Files navigator > "Open as" > "Source"), and then doing a find-and-replace.