I'm using Avenir, which is a font only available in iOS 6, in a project that supports iOS 5. I'm able to change the font when it's referenced in code, but I'm not sure how to change Avenir to Helvetica in the NIB files. Right now everything just defaults to system font, which is semi-acceptable except that all font sizes default to 17 regardless of their specified size in the NIB.
This is a project that has 40+ Nibs, so ideally I can find a solution that doesn't require manually editing each nib and its owner to add UILabel IBOutlets.
Thanks
You could purchase the font and include it in your application. That way you will have consistency with iOS5 and iOS6. I would say that is your easiest solution.
Font
Include custom font in application
Related
I try to custom fonts like I used to do in XIB,after upgrade Xcode to 7 ,
I cannot find STHeitiSC in the font list?
Is it deprecated?
Sadly, it is no longer a supported IB font. See my issues with it here : Xcode 7 iOS9 font no longer recognized
This font is usually reserved and intended only for Chinese text. However, you can still import the font to your project, add it to your plist and perform accordingly as any other custom font would.
In my app I need to support iOS since iOS 7. As you know iOS 9 uses new system font "San-Francisco".
Is it possible some how to use system font (to make native font for operation system) with setting size and attributes like Light, Medium, Bold, Italic, etc?
I found only one solution to hard code font name as for iOS 9 use "San-Francisco" and for less use "HelveticaNueue".
Maybe some one know a better solution.
Trying to style my UILabel, in Attributes Inspector I set the font of my attributed text to Apple Chancery. In the preview window it shows correctly, but in the UIView itself the font is not applying. And when I try running the device just in case, the font still does not show. If I change the font to something else, this "something else" shows. So is there a known problem with iPhone simulators and devices not showing certain fonts that are in fact available in Xcode? I am using Xcode-6
Xcode displays fonts found in the Mac, not on the actual iOS device. Before selecting a font, you should make sure it is available on iOS devices.
Sites such as http://iosfonts.com/ or even trial and error can help.
Apple Chancery is only present in Mac OS X, but you can load ttf programmatically (see Google for the ttf) :
(I don't know if you are allowed to use this font via ttf, see the font license)
Copy the ttf to your Xcode project
Link your UILabel to your source code
Then, set custom font :
[myLabel setFont: [UIFont fontWithName:#"Apple Chancery" size:15]];
How can I add a custom font (by custom i mean, the font that dont exist in xcode) in font selector which comes through XIB?
I have added the font to the bundle and added it to the plist. I can use the font programmatically but I want to use it through XIB.
Xcode uses the fonts installed on the computer. Add the font to your ~/Library/Fonts folder or double click the font and install it using Font Book.
The font selector in Xcode also allows you to type directly into it. I imagine you can type whatever font you want here and it will work at run time if the font is found, but to use it during development I'm pretty sure you need to have it installed.
If you're looking for a WYSIWYG preview of a custom font in Interface Builder, this isn't possible (even in Xcode 5).
Like you mentioned, you may continue to set the font programmatically.
I'm trying to render a simple UITextView in a custom font in my iOS app. This font is for the Urdu language and I specifically need the stylized look of the characters.
I'm certain that I've followed all requisite steps correctly (the .ttf file's target membership, info.plist entry, finding out and using the right font name etc.), since I confirmed this by logging:
NSLog(#"%#", poem.font.fontName);
where *poem is my UITextView.
The strange thing is that when I install this font on my Mac and type in the same text in text-edit, the font renders as it should.
Mac OS screenshot:
Simulator/iOS Device screenshot:
Any explanation?
You can simply use UITextView, but instead of using the text property, use the attributedText property to set the text. That should do the trick, in iOS 7+.
If you want to support iOS 6 or earlier, use CoreText.