代碼: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. NSLog(@"--系統的所有字體--%@",[self getAllSystemFonts]); NS ...
代碼:
- (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;
}