代码:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSLog(@"--系统的所有字体--%@",[self getAllSystemFonts]);
NSLog(@"--系统当前字体--%@",[self getCurrentFont]);
}
//获得系统的所有字体
- (NSArray*)getAllSystemFonts;
{
NSMutableArray *array = [[NSMutableArray alloc] init] ;
NSArray* familys = [UIFont familyNames];
for (id obj in familys) {
NSArray* fonts = [UIFont fontNamesForFamilyName:obj];
for (id font in fonts)
{
[array addObject:font];
}
}
return array;
}
//获得系统的当前字体
- (UIFont*)getCurrentFont
{
//判断系统字体的size,返回使用的字体。
UIFont *font = [UIFont systemFontOfSize:[UIFont systemFontSize]];
return font;
}