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.
Related
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.
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.
From iOS 8 it is possible to add custom keyboard from our application which can be used system wide.
I need to create such a keyboard which can be used to input custom characters(a new language). I have these characters as images.
How can I use these images to input as characters from the keyboard into a textfield?
Please suggest any tips, link, methods etc..
Thanks in advance
You cannot put custom images in text fields because they are used to input text, not images.
The only possibility is custom font with images, but it will not be available system-wide and text fields are under control of the host app. For the available methods to insert characters see this documentation page
Try to follow this guide. Actually I've found plenty of similar guides using google.
Also Apple's custom keyboard guidelines might be helpful
Is it possible to redefine standard text styles: UIFontTextStyleBody, UIFontTextStyleHeadline, etc.?
Seems that it's not.
As I understand it's similar to the custom CSS sheet in Safari — user select fonts he like, and then he see those fonts in apps, that support dynamic fonts.
Maybe UIAppereance can be to help? It allows you to set fonts and styles for any kind of view/element in any controller.
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.