iPhone system font

前端 未结 12 502
日久生厌
日久生厌 2020-12-12 18:31

What is the name of the default system font on the iPhone?

I would like to retrieve this for customizing a UIView.

相关标签:
12条回答
  • 2020-12-12 19:05

    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.

    0 讨论(0)
  • 2020-12-12 19:06
    1. download required .ttf file

    2. add the .ttf file under copy bundle resource, double check whether the ttf file is added under resource

    3. In info.pllist add the ttf file name as it is.

    4. now open the font book add the .ttf file in the font book, select information icon there you find the postscript name.

    5. now give the postscript name in the place of font name

    0 讨论(0)
  • 2020-12-12 19:07

    The default font for iOS is San Francisco . You can refer the link for further details

    0 讨论(0)
  • 2020-12-12 19:09

    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.

    0 讨论(0)
  • 2020-12-12 19:16

    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!

    0 讨论(0)
  • 2020-12-12 19:16
    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.

    0 讨论(0)
提交回复
热议问题