1.中文字型
轉自:https://zhidao.baidu.com/question/1239016138772367339.html
ios7英文字型:Helvetica 下的各種系統,例如Helvetica Neue等,細究起來很煩,不同的地方用不同的系統,但都是Helvetica家族下的ios7中文字型:STHeitiSC-Light 黑體-簡
2.蘋果使用字型
轉自:http://blog.csdn.net/onlyou930/article/details/7422097
label.font = [UIFont fontWithName: @" Arial-BoldItalicMT " size: 24 ];
字型名如下:
Font Family: American Typewriter Font: AmericanTypewriter Font: AmericanTypewriter-Bold Font Family: AppleGothic Font: AppleGothic Font Family: Arial Font: ArialMT Font: Arial-BoldMT Font: Arial-BoldItalicMT Font: Arial-ItalicMT Font Family: Arial Rounded MT Bold Font: ArialRoundedMTBold Font Family: Arial Unicode MS Font: ArialUnicodeMS Font Family: Courier Font: Courier Font: Courier-BoldOblique Font: Courier-Oblique Font: Courier-Bold Font Family: Courier New Font: CourierNewPS-BoldMT Font: CourierNewPS-ItalicMT Font: CourierNewPS-BoldItalicMT Font: CourierNewPSMT Font Family: DB LCD Temp Font: DBLCDTempBlack Font Family: Georgia Font: Georgia-Bold Font: Georgia Font: Georgia-BoldItalic Font: Georgia-Italic Font Family: Helvetica Font: Helvetica-Oblique Font: Helvetica-BoldOblique Font: Helvetica Font: Helvetica-Bold Font Family: Helvetica Neue Font: HelveticaNeue Font: HelveticaNeue-Bold Font Family: Hiragino Kaku Gothic **** W3 Font: HiraKakuProN-W3 Font Family: Hiragino Kaku Gothic **** W6 Font: HiraKakuProN-W6 Font Family: Marker Felt Font: MarkerFelt-Thin Font Family: STHeiti J Font: STHeitiJ-Medium Font: STHeitiJ-Light Font Family: STHeiti K Font: STHeitiK-Medium Font: STHeitiK-Light Font Family: STHeiti SC Font: STHeitiSC-Medium Font: STHeitiSC-Light Font Family: STHeiti TC Font: STHeitiTC-Light Font: STHeitiTC-Medium Font Family: Times New Roman Font: TimesNewRomanPSMT Font: TimesNewRomanPS-BoldMT Font: TimesNewRomanPS-BoldItalicMT Font: TimesNewRomanPS-ItalicMT Font Family: Trebuchet MS Font: TrebuchetMS-Italic Font: TrebuchetMS Font: Trebuchet-BoldItalic Font: TrebuchetMS-Bold Font Family: Verdana Font: Verdana-Bold Font: Verdana-BoldItalic Font: Verdana Font: Verdana-Italic Font Family: Zapfino Font: Zapfino
UIFont fontWithName 後不知道字型的名字,看了下面的全解決。
3.列印字型族,和字型名字
轉自:http://www.2cto.com/kf/201505/397306.html
ios的提供了很多的字型樣式。有時候我們在開發應用的時候可能用到不同的字型,通過此Demo我們可以擷取到所有的字型樣式供我們選擇。 首先擷取字型字型族科名字,再通過族科的名字擷取到字型的名字。
NSArray *arr = [UIFont familyNames];
for (NSString *str in arr) {
NSArray *at = [UIFont fontNamesForFamilyName:str];
for (NSString *fffff in at) {
NSLog(@"字型名字 %@",fffff);
}
}
? 然後再使用如下代碼就可以修改字串的字型 。
// NSString * testStr = @我隨手一打就是漂亮的十五個字了;
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:testStr];
[str addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(0,3)];
[str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(3,4)];
[str addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(7,4)];
[str addAttribute:NSFontAttributeName value:[UIFont fontWithName:_fontArray[indexPath.row] size:30] range:NSMakeRange(0, 15)];
?
顯示中文和英文的效果不是很一致,英文的效果明顯一些,如下是部分效果截圖。具體在Demo裡面有。