首页 > 代码库 > 自定义字体
自定义字体
for (NSString * familyName in [UIFont familyNames]) {
//字体家族名
//---Source Han Sans CN---
NSLog(@"---%@---" , familyName);
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
//字体名
//SourceHanSansCN-ExtraLight
//SourceHanSansCN-Bold
//SourceHanSansCN-Medium
//SourceHanSansCN-Regular
//SourceHanSansCN-Light
NSLog(@"%@" , fontName);
}
//例如:
}
NSArray * arr = @[@"SourceHanSansCN-ExtraLight",@"SourceHanSansCN-Bold",@"SourceHanSansCN-Medium",@"SourceHanSansCN-Regular",@"SourceHanSansCN-Light"];
for (int i = 0; i<5; i++) {
UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0, 80*(i+1), self.view.bounds.size.width, 80)];
label.numberOfLines = 0;
label.font = [UIFont fontWithName:arr[i] size:20];
label.text = @"summer 你好厉害啊";
[self.view addSubview:label];
}
iOS 系统字体 :http://iosfonts.com/
自定义字体