I followed the Apple guide to add a custom font to my application. It does work only if I also add the font to my system. If I don't I get the following error when opening a storyboard which contains the custom font:
Font “AlmaMono-Bold” does not exist on this system, substituting the system font instead. Saving the document will lose the original font reference.
Is it required to add the custom font to the system or is there other way to do it? There are two main problems with requiring to add the font to the system:
If some other dev wants to work on the project, he gotta remember to add this custom font to his system.
How to handle it in the Continuous Integration server? I use fastlane to build the application and send to the store, but the font was not working.
A storyboard does not magically look in your project for fonts. So opening a storyboard will not display a font unless that font is available on your machine as a whole.
The usual approach is to set the font in code, not in the storyboard.
Related
Can you dynamically load custom fonts in iOS similar to how you do in Javascript?
I have seen few questions about this but they are quite outdated or don't really answer the question.
I don't want to add a font to my application/register it in the info.plist. I want to be able to dynamically load a custom new font that is not in my library then use it within my app.
The only fonts you can download dynamically and use are Apple's own fonts. You can include a font and use it, and you can even make it available to other apps ("font provider"), but you cannot download an arbitrary font. That would be a security hole and Apple doesn't permit it.
I have developed the application in ios. It is working fine. I have converted it as a framework(library) so that My codebase remain same.
I have multiple clients for this app. So I need to change the following things
Colors (As it will change the background colors, text colors etc)
Strings (Like headings and labels in some views)
Some files like Images etc
What I want:
As I am android developer, So in that I can create another color file in my client app with same color name, that replaces the color value in Library. and this it just require only one file to be replace and it automatically overrides in library. Same was the case with the String.xml and image files
Looking for something like that as I have described above.
What I searched and found so far:
After searching alot I have found that I need to make outlets public and then I can give them color by accessing them. But What If I have a 1000 of views and 1000s of outlets to make to use this technique, Isnt it better to use it as same way as in android I described above.
Confusions:
Is there anyway in IOS to declare color in a file and to use them in IB and code as well. Well I read about Color.xcassets but that is for ios 11 I think
How to make strings file and to use them in IB and in code. Like strings.xml file in android?
So I short, I want to updated colors,Strings and file per client wise and I do not know how to do it and what is a best way of doing this??
Please help and thanks in advance. Please share your views.
You should configure your framework to read from predefined files in .plist file. this will require only changing the files content in the client application.
Easy way to handle colors and theme using SkinKit. This is too old code. You just reuse idea or create custom themes configuration file(plist,JSON),Strings and images as .bundle read all color and customization from that bundle. So easy to change Colors, Strings and Images assert for various clients.
You seem to have a misconception about what IB is — in particular, what a nib is, and what it means to edit a nib, which is what Interface Builder does. A nib is a file expressing potential instances, typically views. You edit it on your computer using Xcode (IB). When your app runs, the nib is loaded and the views are actually instantiated. That is the only thing you can do with a nib when the app runs. You cannot modify the nib in some way when the app runs; all you can do is load the nib and get the instances.
So, if you want to change all the titles of buttons or all the colors of views when your app runs in accordance with some configuration file, you can do that, but that has nothing to do with nibs or IB. You would just load the nib as usual to get the views, and then change them all, one by one, in code. You could use tags or some other identification mechanism to help you find each view, but that would be entirely up to you to work out.
I'm using a custom font for English version of my app, before localizing for other languages, the font displayed fine, then I localized the app for Chinese, the custom font is replaced by system font when I run it, though it still looks right on the storyboard.
I set the font in storyboard, I think it's a easier approach as I have multiple view controllers using this font in different places, it'd be a little complicated to set font with code, here's the storyboard setting:
and info.plist:
localization:
So, what's wrong?
Problem solved by disabling localization of the font like this:
I'm using a label to display text with my custom font on LaunchScreen.xib. My custom font shows up fine in the Interface Builder, but when I test it on my iPhone the font reverts back to the default font.
Not sure how to fix this or if it's a bug.
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.
A quick workaround is to use an UIImageView and have your text as UIImage on it, literally a picture of your text as .png / .jpeg or similar.
Note: It may take some time before you can see the image, I had to clean the Build Folder and reinstall the app a couple of times in order to see the image.
Another note: If you want to support multiple languages with different texts you will need to have different images for each language using this approach.
Is there a way to set style or look and feel for ipad application as it works for java applications?
In particular, i want to set my custom Font application-wide, so that all buttons/labels/whatever created would use my Font by default. All that i found so far concerning fonts suggests that every single control i create should be set up individually. Is it so or is there way to set up default Font properties for whole project?
This is usually a bad idea from the UI viewpoint, therefore there is no “skinning” support in iOS. (Java has it different, because it wants to support different systems with different UI metaphors.) If you want to use a custom font, you can create custom subclasses of the UI components that will set your font after awaking from NIB or after the instance is created in code.