实用小技巧(六):打印ios里所有字体

版本记录

版本号 时间
V1.0 2017.06.23

前言

很多app都有建立小组或者社区的功能,或者给某人添加几个描述标签等等,这些功能都需要动态的添加标签视图,这一篇就讲述一下添加方法。感兴趣的可以看看我写的其他小技巧
1. 实用小技巧(一):UIScrollView中上下左右滚动方向的判断

2. 实用小技巧(二):屏幕横竖屏的判断和相关逻辑
3.实用小技巧(三):点击手势屏蔽子视图的响应
4.实用小技巧(四):动态的增删标签视图
5.实用小技巧(五):通过相册或者相机更改图标

详情

  很多时候我们都需要设置字体的颜色,ios有自己的字体库,比如PingFangSC库名字,它里面也包含了很多其他的字体,下面我们就用代码打印出来字体。先看代码。

#pragma mark - Object Private Function

- (void)getFontNames
{
    NSArray *familyNames = [UIFont familyNames];
    
    for (NSString *familyName in familyNames) {
        printf("familyNames = %s\n",[familyName UTF8String]);
        
        NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName];
        
        for (NSString *fontName in fontNames) {
            printf("\tfontName = %s\n",[fontName UTF8String]);
        }
    }
}

下面我们就看输出结果。

familyNames = Copperplate
    fontName = Copperplate-Light
    fontName = Copperplate
    fontName = Copperplate-Bold
familyNames = Heiti SC
familyNames = Kohinoor Telugu
    fontName = KohinoorTelugu-Regular
    fontName = KohinoorTelugu-Medium
    fontName = KohinoorTelugu-Light
familyNames = Thonburi
    fontName = Thonburi
    fontName = Thonburi-Bold
    fontName = Thonburi-Light
familyNames = Heiti TC
familyNames = Courier New
    fontName = CourierNewPS-BoldMT
    fontName = CourierNewPS-ItalicMT
    fontName = CourierNewPSMT
    fontName = CourierNewPS-BoldItalicMT
familyNames = Gill Sans
    fontName = GillSans-Italic
    fontName = GillSans-Bold
    fontName = GillSans-BoldItalic
    fontName = GillSans-LightItalic
    fontName = GillSans
    fontName = GillSans-Light
    fontName = GillSans-SemiBold
    fontName = GillSans-SemiBoldItalic
    fontName = GillSans-UltraBold
familyNames = Apple SD Gothic Neo
    fontName = AppleSDGothicNeo-Bold
    fontName = AppleSDGothicNeo-UltraLight
    fontName = AppleSDGothicNeo-Thin
    fontName = AppleSDGothicNeo-Regular
    fontName = AppleSDGothicNeo-Light
    fontName = AppleSDGothicNeo-Medium
    fontName = AppleSDGothicNeo-SemiBold
familyNames = Marker Felt
    fontName = MarkerFelt-Thin
    fontName = MarkerFelt-Wide
familyNames = Avenir Next Condensed
    fontName = AvenirNextCondensed-BoldItalic
    fontName = AvenirNextCondensed-Heavy
    fontName = AvenirNextCondensed-Medium
    fontName = AvenirNextCondensed-Regular
    fontName = AvenirNextCondensed-HeavyItalic
    fontName = AvenirNextCondensed-MediumItalic
    fontName = AvenirNextCondensed-Italic
    fontName = AvenirNextCondensed-UltraLightItalic
    fontName = AvenirNextCondensed-UltraLight
    fontName = AvenirNextCondensed-DemiBold
    fontName = AvenirNextCondensed-Bold
    fontName = AvenirNextCondensed-DemiBoldItalic
familyNames = Tamil Sangam MN
    fontName = TamilSangamMN
    fontName = TamilSangamMN-Bold
familyNames = Helvetica Neue
    fontName = HelveticaNeue-Italic
    fontName = HelveticaNeue-Bold
    fontName = HelveticaNeue-UltraLight
    fontName = HelveticaNeue-CondensedBlack
    fontName = HelveticaNeue-BoldItalic
    fontName = HelveticaNeue-CondensedBold
    fontName = HelveticaNeue-Medium
    fontName = HelveticaNeue-Light
    fontName = HelveticaNeue-Thin
    fontName = HelveticaNeue-ThinItalic
    fontName = HelveticaNeue-LightItalic
    fontName = HelveticaNeue-UltraLightItalic
    fontName = HelveticaNeue-MediumItalic
    fontName = HelveticaNeue
familyNames = Gurmukhi MN
    fontName = GurmukhiMN-Bold
    fontName = GurmukhiMN
familyNames = Times New Roman
    fontName = TimesNewRomanPSMT
    fontName = TimesNewRomanPS-BoldItalicMT
    fontName = TimesNewRomanPS-ItalicMT
    fontName = TimesNewRomanPS-BoldMT
familyNames = Georgia
    fontName = Georgia-BoldItalic
    fontName = Georgia
    fontName = Georgia-Italic
    fontName = Georgia-Bold
familyNames = Apple Color Emoji
    fontName = AppleColorEmoji
familyNames = Arial Rounded MT Bold
    fontName = ArialRoundedMTBold
familyNames = Kailasa
    fontName = Kailasa-Bold
    fontName = Kailasa
familyNames = Kohinoor Devanagari
    fontName = KohinoorDevanagari-Light
    fontName = KohinoorDevanagari-Regular
    fontName = KohinoorDevanagari-Semibold
familyNames = Kohinoor Bangla
    fontName = KohinoorBangla-Semibold
    fontName = KohinoorBangla-Regular
    fontName = KohinoorBangla-Light
familyNames = Chalkboard SE
    fontName = ChalkboardSE-Bold
    fontName = ChalkboardSE-Light
    fontName = ChalkboardSE-Regular
familyNames = Sinhala Sangam MN
    fontName = SinhalaSangamMN-Bold
    fontName = SinhalaSangamMN
familyNames = PingFang TC
    fontName = PingFangTC-Medium
    fontName = PingFangTC-Regular
    fontName = PingFangTC-Light
    fontName = PingFangTC-Ultralight
    fontName = PingFangTC-Semibold
    fontName = PingFangTC-Thin
familyNames = Gujarati Sangam MN
    fontName = GujaratiSangamMN-Bold
    fontName = GujaratiSangamMN
familyNames = Damascus
    fontName = DamascusLight
    fontName = DamascusBold
    fontName = DamascusSemiBold
    fontName = DamascusMedium
    fontName = Damascus
familyNames = Noteworthy
    fontName = Noteworthy-Light
    fontName = Noteworthy-Bold
familyNames = Geeza Pro
    fontName = GeezaPro
    fontName = GeezaPro-Bold
familyNames = Avenir
    fontName = Avenir-Medium
    fontName = Avenir-HeavyOblique
    fontName = Avenir-Book
    fontName = Avenir-Light
    fontName = Avenir-Roman
    fontName = Avenir-BookOblique
    fontName = Avenir-MediumOblique
    fontName = Avenir-Black
    fontName = Avenir-BlackOblique
    fontName = Avenir-Heavy
    fontName = Avenir-LightOblique
    fontName = Avenir-Oblique
familyNames = Academy Engraved LET
    fontName = AcademyEngravedLetPlain
familyNames = Mishafi
    fontName = DiwanMishafi
familyNames = Futura
    fontName = Futura-CondensedMedium
    fontName = Futura-CondensedExtraBold
    fontName = Futura-Medium
    fontName = Futura-MediumItalic
    fontName = Futura-Bold
familyNames = Farah
    fontName = Farah
familyNames = Kannada Sangam MN
    fontName = KannadaSangamMN
    fontName = KannadaSangamMN-Bold
familyNames = Arial Hebrew
    fontName = ArialHebrew-Bold
    fontName = ArialHebrew-Light
    fontName = ArialHebrew
familyNames = Arial
    fontName = ArialMT
    fontName = Arial-BoldItalicMT
    fontName = Arial-BoldMT
    fontName = Arial-ItalicMT
familyNames = Party LET
    fontName = PartyLetPlain
familyNames = Chalkduster
    fontName = Chalkduster
familyNames = Hoefler Text
    fontName = HoeflerText-Italic
    fontName = HoeflerText-Regular
    fontName = HoeflerText-Black
    fontName = HoeflerText-BlackItalic
familyNames = Optima
    fontName = Optima-Regular
    fontName = Optima-ExtraBlack
    fontName = Optima-BoldItalic
    fontName = Optima-Italic
    fontName = Optima-Bold
familyNames = Palatino
    fontName = Palatino-Bold
    fontName = Palatino-Roman
    fontName = Palatino-BoldItalic
    fontName = Palatino-Italic
familyNames = Lao Sangam MN
    fontName = LaoSangamMN
familyNames = Malayalam Sangam MN
    fontName = MalayalamSangamMN-Bold
    fontName = MalayalamSangamMN
familyNames = Al Nile
    fontName = AlNile-Bold
    fontName = AlNile
familyNames = Bradley Hand
    fontName = BradleyHandITCTT-Bold
familyNames = PingFang HK
    fontName = PingFangHK-Ultralight
    fontName = PingFangHK-Semibold
    fontName = PingFangHK-Thin
    fontName = PingFangHK-Light
    fontName = PingFangHK-Regular
    fontName = PingFangHK-Medium
familyNames = Trebuchet MS
    fontName = Trebuchet-BoldItalic
    fontName = TrebuchetMS
    fontName = TrebuchetMS-Bold
    fontName = TrebuchetMS-Italic
familyNames = Helvetica
    fontName = Helvetica-Bold
    fontName = Helvetica
    fontName = Helvetica-LightOblique
    fontName = Helvetica-Oblique
    fontName = Helvetica-BoldOblique
    fontName = Helvetica-Light
familyNames = Courier
    fontName = Courier-BoldOblique
    fontName = Courier
    fontName = Courier-Bold
    fontName = Courier-Oblique
familyNames = Cochin
    fontName = Cochin-Bold
    fontName = Cochin
    fontName = Cochin-Italic
    fontName = Cochin-BoldItalic
familyNames = Hiragino Mincho ProN
    fontName = HiraMinProN-W6
    fontName = HiraMinProN-W3
familyNames = Devanagari Sangam MN
    fontName = DevanagariSangamMN
    fontName = DevanagariSangamMN-Bold
familyNames = Oriya Sangam MN
    fontName = OriyaSangamMN
    fontName = OriyaSangamMN-Bold
familyNames = Snell Roundhand
    fontName = SnellRoundhand-Bold
    fontName = SnellRoundhand
    fontName = SnellRoundhand-Black
familyNames = Zapf Dingbats
    fontName = ZapfDingbatsITC
familyNames = Bodoni 72
    fontName = BodoniSvtyTwoITCTT-Bold
    fontName = BodoniSvtyTwoITCTT-Book
    fontName = BodoniSvtyTwoITCTT-BookIta
familyNames = Verdana
    fontName = Verdana-Italic
    fontName = Verdana-BoldItalic
    fontName = Verdana
    fontName = Verdana-Bold
familyNames = American Typewriter
    fontName = AmericanTypewriter-CondensedLight
    fontName = AmericanTypewriter
    fontName = AmericanTypewriter-CondensedBold
    fontName = AmericanTypewriter-Light
    fontName = AmericanTypewriter-Semibold
    fontName = AmericanTypewriter-Bold
    fontName = AmericanTypewriter-Condensed
familyNames = Avenir Next
    fontName = AvenirNext-UltraLight
    fontName = AvenirNext-UltraLightItalic
    fontName = AvenirNext-Bold
    fontName = AvenirNext-BoldItalic
    fontName = AvenirNext-DemiBold
    fontName = AvenirNext-DemiBoldItalic
    fontName = AvenirNext-Medium
    fontName = AvenirNext-HeavyItalic
    fontName = AvenirNext-Heavy
    fontName = AvenirNext-Italic
    fontName = AvenirNext-Regular
    fontName = AvenirNext-MediumItalic
familyNames = Baskerville
    fontName = Baskerville-Italic
    fontName = Baskerville-SemiBold
    fontName = Baskerville-BoldItalic
    fontName = Baskerville-SemiBoldItalic
    fontName = Baskerville-Bold
    fontName = Baskerville
familyNames = Khmer Sangam MN
    fontName = KhmerSangamMN
familyNames = Didot
    fontName = Didot-Italic
    fontName = Didot-Bold
    fontName = Didot
familyNames = Savoye LET
    fontName = SavoyeLetPlain
familyNames = Bodoni Ornaments
    fontName = BodoniOrnamentsITCTT
familyNames = Symbol
    fontName = Symbol
familyNames = Menlo
    fontName = Menlo-Italic
    fontName = Menlo-Bold
    fontName = Menlo-Regular
    fontName = Menlo-BoldItalic
familyNames = Bodoni 72 Smallcaps
    fontName = BodoniSvtyTwoSCITCTT-Book
familyNames = Papyrus
    fontName = Papyrus
    fontName = Papyrus-Condensed
familyNames = Hiragino Sans
    fontName = HiraginoSans-W3
    fontName = HiraginoSans-W6
familyNames = PingFang SC
    fontName = PingFangSC-Ultralight
    fontName = PingFangSC-Regular
    fontName = PingFangSC-Semibold
    fontName = PingFangSC-Thin
    fontName = PingFangSC-Light
    fontName = PingFangSC-Medium
familyNames = Myanmar Sangam MN
    fontName = MyanmarSangamMN-Bold
    fontName = MyanmarSangamMN
familyNames = Euphemia UCAS
    fontName = EuphemiaUCAS-Italic
    fontName = EuphemiaUCAS
    fontName = EuphemiaUCAS-Bold
familyNames = Telugu Sangam MN
familyNames = Bangla Sangam MN
familyNames = Zapfino
    fontName = Zapfino
familyNames = Bodoni 72 Oldstyle
    fontName = BodoniSvtyTwoOSITCTT-Book
    fontName = BodoniSvtyTwoOSITCTT-Bold
    fontName = BodoniSvtyTwoOSITCTT-BookIt

这里就有我们经常用的字体。

familyNames = PingFang SC
    fontName = PingFangSC-Ultralight
    fontName = PingFangSC-Regular
    fontName = PingFangSC-Semibold
    fontName = PingFangSC-Thin
    fontName = PingFangSC-Light
    fontName = PingFangSC-Medium

大家看看就可以了。

后记

这里就是给大家看看的,看看就可以了。

风景壁纸

推荐阅读更多精彩内容