如何在iPhone应用程序中以编程方式获取所有系统字体familymane 我想显示它,以便用户可以选择它
答案 0 :(得分:3)
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];
通过使用此代码,您可以获取字体名称及其姓氏
答案 1 :(得分:0)
试试此代码
NSLog("%@",[UIFont familyNames]);