Fonts on iOS device

后端 未结 6 1225
醉酒成梦
醉酒成梦 2020-12-13 09:13

I\'ve read the available font families by [UIFont familyNames], but I\'ve got various lists on different devices (but with the same iOS version). Can somebody tell me, if th

6条回答
  •  天涯浪人
    2020-12-13 09:47

    Here is the correct snippet for listing out all the fonts:

        // List all fonts on iPhone
    NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
    NSArray *fontNames;
    NSInteger indFamily, indFont;
    for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
    {
        NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
        fontNames = [[NSArray alloc] initWithArray:
                     [UIFont fontNamesForFamilyName:
                      [familyNames objectAtIndex:indFamily]]];
        for (indFont=0; indFont<[fontNames count]; ++indFont)
        {
            NSLog(@"    Font name: %@", [fontNames objectAtIndex:indFont]);
        }
    }
    

提交回复
热议问题