LaunchScreen.xib not displaying my custom font
There's no big surprise here. The launch screen is shown at launch time - actually, before launch time - so the font probably hasn't yet loaded.
You could file a bug if you think you have a compelling use case. But I don't really think you do. Why are you showing any text in your launch image? It should be much more bare-bones than that - just enough to give the structure of the opening interface, which will be filled in when the opening interface actually appears. A "blank" screen with the same background color as the initial view controller's background color would be sufficient. You goal is just to provide an alternative to blackness.
Custom font set in a storyboard won't display on device
Place this piece of code in your AppDelegate (didFinishLaunchingWithOptions:) to check that the custom fonts are available in the project:
NSArray *fontFamilies = [UIFont familyNames];
for (int i = 0; i < [fontFamilies count]; i++)
{
NSString *fontFamily = [fontFamilies objectAtIndex:i];
NSArray *fontNames = [UIFont fontNamesForFamilyName:[fontFamilies objectAtIndex:i]];
NSLog (@"%@: %@", fontFamily, fontNames);
}
Fonts on launch screen are different than main storyboard
You can't use custom fonts on the Launch screen.
Only standard system fonts.
System will automatically replace your custom font to system during runtime.
How to set font to the label in launch Screen in iOS 8
Even though it may appear like you can in Xcode 6, you can't specify a custom font for the launch screen, since the launch screen is shown before your fonts load. Create an image of your text and use that.
Xcode 7.2.1 Custom font in Interface bulilder
Final Edit:
If you don't mind, I'll reword your question as I understand it much better now that you've kindly supplied me with your project.
In short your question is this:
My custom font does not work in my launch storyboard despite
the fact that it works elsewhere in the main app. How can I make it work in the launch screen?
It appears that you can't use custom fonts in a launch screen as they haven't yet been loaded. There are a number of answers on Stack Overflow confirming this. See here, here and here.
My advice would be to either avoid using the fonts in the storyboard or use them as an image.
Let's go through a number of the steps one-by-one to see if we can pinpoint the problem here.
Step 1. In your plist
have you included the fonts under UIAppFonts
aka Fonts provided by application
? Like this:
Step 2. Also, have you made sure that the correct targets are selected? Like this:
Step 3. Also, try running this to see if your fonts are listed. If not then make sure they are spelled exactly as the filenames.
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSLog(@"Fonts: %@", [UIFont familyNames]);
Step 4. Another also - check the Font Book application on your mac, search for the font and find its correct name. Like this:
Step 5. Then check that the font is included in the bundle resources for the project like this:
Step 6. And finally double check that you selected to copy the fonts to the bundle when you added them to your project, like this:
Edit
It seems that the font works for you iff you refer to it in code but not if you refer to it using IB. So maybe...
Step 7. Delete the app from the simulator, clean the project and then rebuild.
Custom system font for a UIBarButtonItem in a toolbar for LaunchScreen.xib
You can use UIBarButtonItem
with a custom view. You can do that in a storyboard/xib just by dragging and dropping a view/button to your toolbar and it will create a UIBarButtonItem
with the nested view.
The code will look like this:
<barButtonItem style="plain" id="AwC-sg-sT1">
<view key="customView" contentMode="scaleToFill" id="4Z4-cp-rPM">
<rect key="frame" x="0.0" y="0.0" width="320" height="33"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</barButtonItem>
Related Topics
Looping Through Nsattributedstring Attributes to Increase Font Size
Autolayout Link Two Uilabels to Have the Same Font Size
Unexpected Non-Void Return Value in Void Function Swift3
Core Data in Swift: Only Saving Last Object in a for Loop
Uitableview Inside Uiscrollview Not Receiving First Tap After Scrollling
Iphone:Daily Local Notifications
Handling Push Notifications When App Is Terminated
Convert an iOS Objective C Object to a JSON String
How to Get Image Metadata in iOS
Storyboard View Elements Greyed Out
Send Messages Between iOS and Watchos with Watchconnectivity in Watchos2
What Does the Text Inside Parentheses in @Interface and @Implementation Directives Mean
Using JSONencoder to Encode a Variable with Codable as Type
The Supportedinterfaceorientations Method Doesn't Override Any Method from Its Superclass