Visual List of iOS Fonts?

后端 未结 7 1931
你的背包
你的背包 2020-12-23 09:14

I am looking for a list of iOS Fonts for iOS 7. I have found the list on Apple\'s developer site, I am just wondering if anyone knows of a visual list where each font name

7条回答
  •  滥情空心
    2020-12-23 09:20

    (Original answer in ObjC) You can get a list at run-time:

    // available fonts listed in xcode output
    for (id familyName in [UIFont familyNames]) {
        NSLog(@"%@", familyName);
        for (id fontName in [UIFont fontNamesForFamilyName:familyName]) NSLog(@"  %@", fontName);
    }
    

    (Added: Swift one liner):

    UIFont.familyNames.forEach{ print($0); UIFont.fontNames(forFamilyName: $0).forEach{ print("  ", $0) } }
    

    This will spit out:

    Thonburi
      Thonburi-Bold
      Thonburi
      Thonburi-Light
    Snell Roundhand
      SnellRoundhand-Black
      SnellRoundhand-Bold
      SnellRoundhand
      ...
    

    I have also made a small app that can be used to browse through all the available fonts. Check it out here.

提交回复
热议问题