What is the name of the default system font on the iPhone?
I would like to retrieve this for customizing a UIView
.
To the delight of font purists everywhere, the iPhone system interface uses Helvetica or a variant thereof.
The original iPhone, iPhone 3G and iPhone 3GS system interface uses Helvetica. As first noted by the always excellent DaringFireball, the iPhone 4 uses a subtly revised font called "Helvetica Neue." DaringFireball also notes that this change is related to the iPhone 4 display rather than the iOS 4 operating system and older iPhone models running iOS 4 still use Helvetica as the system font.
iPod models released prior to the iPhone use either Chicago, Espy Sans, or Myriad and use Helvetica after the release of the iPhone.
From http://www.everyipod.com/iphone-faq/iphone-who-designed-iphone-font-used-iphone-ringtones.html
For iOS9 it has changed to San Fransisco. See http://developer.apple.com/fonts for more info.
download required .ttf file
add the .ttf file under copy bundle resource, double check whether the ttf file is added under resource
In info.pllist add the ttf file name as it is.
now open the font book add the .ttf file in the font book, select information icon there you find the postscript name.
now give the postscript name in the place of font name
The default font for iOS is San Francisco . You can refer the link for further details
If you're doing programatic customisation, don't hard code the system font. Use UIFont systemFontOfSize:
, UIFont boldSystemFontOfSize:
and UIFont italicSystemFontOfSize
(Apple documentation).
This has become especially relevant since iOS 7, which changed the system font to Helvetica Neue.
This has become super especially relevant since iOS 9, which changed the system font again to San Francisco.
Category UIFontSystemFonts for UIFont (UIInterface.h) provides several convenient predefined sizes.
@interface UIFont (UIFontSystemFonts)
+ (CGFloat)labelFontSize;
+ (CGFloat)buttonFontSize;
+ (CGFloat)smallSystemFontSize;
+ (CGFloat)systemFontSize;
@end
I use it for chat messages (labels) and it work well when I need to get size of text blocks.
[UIFont systemFontOfSize:[UIFont labelFontSize]];
Happy coding!
UIFont *systemFont = [UIFont systemFontOfSize:[UIFont systemFontSize]];
This will give you the system font with the default system font size applied for the label texts by default.