Custom Font not working in iOS 5

前端 未结 4 654
被撕碎了的回忆
被撕碎了的回忆 2021-01-16 08:30

I have added Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf font in my resources. Also added the same to Fonts provided by application in my info.p

4条回答
  •  误落风尘
    2021-01-16 09:17

    I just want to add to this answer that not all the time this follows this rule. The best way is register the font in your application and perform a quick check and validate the font name.

    Objective-c

     for (NSString *familyName in [UIFont familyNames]) {
        for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
            NSLog(@"%@", fontName);
        }
    }
    

    Swift

     for familyName in UIFont.familyNames() {
            for fontName in UIFont.fontNamesForFamilyName(familyName){
                print(fontName)
            }
        }
    

提交回复
热议问题