user1047415
user1047415

Reputation:

Font familyname programmatically in iphone

How to get all system font familymane by programmatically in iPhone app i want to display it so user can choose it

Upvotes: 2

Views: 931

Answers (2)

rakeshNS
rakeshNS

Reputation: 4257

Try this code

 NSLog("%@",[UIFont familyNames]);

Upvotes: 0

Hector
Hector

Reputation: 3907

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]);
    }
    [fontNames release];
}
[familyNames release];

by using this code you can get Font Name and its familyname

Upvotes: 3

Related Questions