Xcode 8 custom font doesn't show up in interface builder
Try Below Steps: Code tested in Swift 3
.
Step 1: Add Your custom font into your project( Make sure Add to Target
ticked).I am using "PermanentMarker.ttf","Pecita.otf" and "AROLY.ttf" font as a test font.
Note: Supporting font Type ttf and otf (Both font types should work)
Step 2: Modify the application-info.plist file.
Add the key "Fonts provided by application" in a new row and add "PermanentMarker.ttf" as new item in the Array "Fonts provided by application".
Your plist should looks like this
Now the font will be available in Interface Builder. To use the custom font in code we need to refer to it by name, but the name often isn’t the same as the font’s filename
Now, You can access the Custom Font from your viewController. I am testing the font by placing a UIlabel to the Storyboard like below.
Update 2: Working Solution
After, imported your custom font and updated your plist
.selectlabel
from your storyBoard
,goto Attributes Inspector
under Label
>Text type
> select to Attributed
and choose your custom font
from the list.
Output:
Update 1
If your custom font still not listed in Xcode font list
.check the related link to your issue
http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/
custom font not displaying on some simulator
Note: Still,You can assign BebasNeue
or custom font
programatically to your label or button etc. even its not showing in your interface Builder
.If you having trouble setting font to your object programatically.try below method.
Assign font to UILabel:
label?.font = UIFont(name: "BebasNeue", size: 35) // Set to any size
Assign font to UIButton:
button.titleLabel?.font = UIFont(name: "BebasNeue", size: 35)
Assign font to UITextField:
textField.font = UIFont(name: "BebasNeue", size: 25)
Assign font to UINavigationBar:
navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont(name: "BebasNeue", size: 25)!, NSForegroundColorAttributeName: UIColor.red]
Assign font to UIToolBar:
UIBarButtonItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont(name: "BebasNeue", size: 25.0)!], for: UIControlState.normal)
Output:
Fonts not displaying in Interface Builder
For others who might be interested: there is a bug/known issue with IB on XCode 3.x with non-standard fonts and Interface Builder. Custom fonts generally need to be set programatically (via [UIFont fontWithName...).
For mockups you should use a tool like PhotoShop, etc rather than Interface Builder.
Custom font seen in Interface builder but not in code in iOS project
You're going to kick yourself...
In your plist info file, you have:
`Quicksand-Dash.otf`
but the file you added is named:
`Quicksand_Dash.otf`
underscore not hyphen
Either rename your file, or edit the plist entry, and you'll see your font.
Debug console output:
family: Quicksand
name: Quicksand-BoldItalic
name: QuicksandDash-Regular
name: Quicksand-Bold
Here is a plain single-view project that works fine for me - on both Simulator and Device. (I have not added the fonts to OS X, only to my project):
https://github.com/DonMag/Quicksand
Just for setup reference:
Custom Fonts not showing on Xcode 11 (macOS Catalina)
Unfortunately, the only solution for me was a fresh install of mac os catalina. Now everything works correctly in xCode interface builder.
Using custom fonts in interface builder
I have also this problem in Xcode 4. In my program, there are lots of UILabel
which have no IBOutlets
so I do in that way;
First, subclass the UILabel
to CustomFontLabel
Then, override the "awakeFromNib
" method
@implementation CustomFontLabel
- (void)awakeFromNib {
[super awakeFromNib];
self.font = [UIFont fontWithName:@"CustomFontName" size:self.font.pointSize];
}
@end
Finally, in Interface Builder > Identity Inspector change class to CustomFontLabel
.
Custom font displays in IB but not in simulator
It appears that, while when I first imported the font into my project I selected "Add to target membership", after inspecting the font, it was not added to the target! It worked just fine in Interface Builder, but didn't work in the sim or when compiled.
Selecting the font file in the project folder view and checking the target membership box fixed it:
iOS setting custom font in interface builder does not work on device
Steps which are done for Font is correct, but as per my understanding 2 things are there first is Xcode displays fonts which are found in the Mac OS or in your system, not on the actual iOS device. Before selecting a font, you should make sure it is available on iOS devices. and second is when we edit text in xib,custom Fonts appear, but at runtime it will not get applied.
So it is better that you apply font pragmatically.
http://iosfonts.com/ , http://support.apple.com/en-in/HT202771 or even trial and error can help.
Custom font are not showing in new storyboard
The project was developed on another machine. So these fonts were not installed on my machine. I just double click on all fonts and clean the project and Quit the Xcode and open again. Now it's working fine.
Related Topics
Error Domain=Nsposixerrordomain Code=100 "Protocol Error"
Apple Watch - Only Getting Data If App on Phone Is Active
Dyld: Library Not Loaded for a Framework Within a Framework
Cncopycurrentnetworkinfo with iOS 13
Generate Rsa Public Key from Modulus and Exponent
How to Segue with Data from One Tab to Another Tab Properly
iOS Custom Annotation: a View Below the Annotation Pin
<Googlemaps/Googlemaps.H> File Not Found Google Maps Sdk for iOS
Ibm Worklight 6.1 - Failed Re-Generating the iPhone Native Folder
Uiimagepickercontroller in Swift 3
Uploads Using Backgroundsessionconfiguration and Nsurlsessionuploadtask Cause App to Crash
Admob Sdk - iOS -File Not Found
Nsinteralinconsistencyexception - Uikeyboardlayoutalignmentview
React-Native Loading Image Over Https Works While Http Does Not Work
Detecting Tap Inside a Bezier Path
Afnetworking 2.2.0 Upload Image on Server Issues
How to Get Vcf Data with Contact Images Using Cncontactvcardserialization Datawithcontacts: Method