I am trying to add custom fonts, however, the target membership is not shown to me in Xcode 12.5.1
What should appear
What actually appears
How can I solve this?
After you added the custom font files, you must add the name list of the fonts in Info.plist file as below
I have added custom fonts (Roboto) in xamarin studio for ios ,integrated fonts path in plist but these fonts are not working and not inherited in xcode attribute inspector.can anyone help me please?
While adding Custom font carefully checked these boxes. Otherwise xcode will not load custom fonts on runtime. Hope this helps you.
first time using SO to ask a question after lurking for so long.
I have added a custom font for some UITextFields and UITextViews in the Storyboard....
screenshot of storyboard
...but the fonts are not showing on the Simulator, nor the actual device (iPad 2, iPad Mini3).
screenshot of simulator
Please advise on how you got through this, or any additional information that you may need. Thanks! Running XCode 7.3.1 on El Capitan 10.11.6.
The iOS Application in development is set for running on iOS 9.3 and above.
You should add custom fonts to your application folder (TTF/OpenType) and then, modify the application-info.plist file. Add the key "Fonts provided by application" to a new row
It supports TTF and OpenType fonts both. One caveat is that it loads and parses all fonts in the startup of your app, so it will slow down the initial load time.
You also have to add the fonts to the "Copy Bundle Resources" in the Build phases.
Check that your font file's (exp. Chewy.ttf) target is set to the app target.
Steps:
select the font file
Check target membership in File inspector
Add your custom font into your project. i.e. Dragged the font file(ocrb.TTF) into XCode project.
check below link you solve your issue : Custom Font issue
Try adding you font name into your info.plist with full path.
i.e.: fonts/Arial.ttf
I have downloaded Open Sans font and added all the .tff files into my Xcode project, and have checked the checkbox in "Target Membership" pane for each file. I have added the UIAppFonts key and values in Info.plist, and I am sure that the values are typo-free. Plus, the .tff files are added to "Copy Bundle Resources", and the custom font is showing up in Interface Builder. And then I changed the font of all the labels to Open Sans in the Interface Builder (no code).
But when I run the app in the simulator, all the labels and buttons are showing the system font in ultra small sizes, like this:
One thing to note is that I am using Xcode 7 beta 5, and the app's Base SDK is iOS 9.
But why is there this problem? Is it a bug? Thanks!
Check That fonts inside the proyect are part of the target.
Select fonts, verify the property Target Membership for your app is checked at the right in File Inspector.
That solved the problem for me:
Blip, here's a photo of what I did in an empty "Single View" project. And, I could see the font on sim and IB editor. Anything look different for your project? Maybe recreate the basics in a new project, just to double check? All of my notes on the image were associated with my original thoughts...just use them for reference as you double check things.
I recently encountered this problem too. But it only happened for one font-style of a font-family, the others worked fine.
I could only solve it by using this font in a button, then the font was also available for other controls such as labels or the large title.
After upgrading to Xcode 6.3 (release version), Xcode now freeze every time I open a XIB/Storyboard file that includes an IB_DESIGNABLE view that uses a custom font for any projects and includes a custom font (not necessarily to have reference to that font in that XIB/Storyboard). The freeze occurs after opening the .xib file and then attempting to switch to any other file. Xcode hangs and must be force quit.
I have opened a bug report with Apple. (Bug 20483867).
Right now, I have two work arounds.
Download and use Xcode 6.2 from Apple.
Remove the IB_DESIGNABLE tags from the custom view header files.
This is likely an Apple bug, but does anyone have a better work around or solution?
I've already suggested an edit for a more accurate description.
It only happens when your project contains a custom font.
It'll freeze just by visiting any Storyboard/XIB that contains an IBDesignable custom view, not even referencing to that font in your Storyboard/XIB.
My workaround is to use have an older version of Xcode also installed (Xcode 6.3 beta or Xcode 6.2) and use that to update your Interface Builder files, and never open it in 6.3. open those Storyboard/XIB in a new window in Xcode with option+shift+click the file in the project tree.
Whenever you encounter the freeze, I use this command to clear the saved state just for that project.
rm -rf YourProject.xcodeproj/project.xcworkspace/xcuserdata
Xcode 6.3.1 fixes the problem with custom fonts and IB_DESIGNABLE views in a Storyboard. Update via the Mac App Store, and you should be good.
Response from Apple: Link to Developer Forums on Apple
Thank you all for your reports. We are tracking this on our end and working hard to resolve it. Unfortunately we don't have a great workaround, but here are two options to get you going:
If Xcode is hanging on launch because a storyboard/XIB using a custom font/IBDesignable was previously open: remove the "UserInterfaceState.xcuserstate" file inside the xcodeproj of the project you are opening, it would be at a path like this: My App.xcodeproj/project.xcworkspace/xcuserdata/yourusername.xcuserdatad/UserInterfaceState.xcuserstate
If you really need to edit the storyboard/XIB file containing the custom font with Xcode 6.3:
Make a copy of your storyboard/XIB file as a backup
Open the storyboard/XIB file in a text editor
Remove XML tags named "fontDescription" that reference your custom font, for example: . Removing this tag will revert the font to the standard system font.
Make outlets to the objects using the custom font and at runtime set the font of those objects to your custom font, for example in an override of viewDidLoad or awakeFromNib on your view controller
IMPORTANT NOTE: we never recommend hand editing storyboard/XIB files. However we recognize this issue is preventing many of you from editing your documents and wanted to provide a workaround with the caveat that any hand editing may result in corruption of your document.
Same problem for me. Removing IB_DESIGNABLE fixes the problem.. Going back to 6.2 doesn't work for me as I'm testing apps on device with iOS 8.3 - Xcode 6.2 can't run apps on devices with iOS 8.3 :(
Another workaround is to change the file extensions to all of your font files and load the changed file names from Info.plist.
This way you can keep IBDesignables and still use your custom fonts, but wont be able to see them in the Font Picker in Interface Builder.
All custom fonts that were peviously set from Interface Builder will continue to work, but in order to change them or to set another custom fonts, you will have to do it either from code or to modify the Storyboard or Nib files from text editor in order to set the font name.
I don't have an answer but found out that simply force-quitting and restarting will re-launch Xcode in the exact same situation. To just be able to restart Xcode, remove the folder ~/Library/Saved Application State/com.apple.dt.Xcode.savedState.
This bug has been fixed in the 6.4 Xcode beta that came out today. Go to the dev center and log in to download it.
Xcode 8.1 - if you have a view with Navigation (in my case it was top Bar opaque Navigation Bar), just try to set property "top Bar" to None.
As a workaround,I just commented out all the #IBDesignable markup in my handful of custom components that use this. When I did that, yes I lose ability to tweak the settings in Interface Builder, but it allowed me to at least open the .xib files w/out XCode crashing.
I will simply un-comment those #IBDesignable lines when Apple comes up w/ a fix.
#O. Kurnenkov's answer worked for me. It didn't have anything to do with IB_Designable nor custom fonts, Cocoapods, etc.
For some reason having an "Opaque Navigation Bar" causes the nib file (it doesn't seem to affect storyboards) to constantly change y position; this can be seen in the Size Inspector where the y position will flicker between 0 and 64. This is happening to me with Xcode 8.2 (8C38).
My guess here is that this causes Xcode to constantly update the layout thus draining resources and causing it to hang/freeze.
The solution is to use any of the "Translucent" options, Inferred, or None.
Hope this helps!