ios 关于fontwithname的字体样式设置
label.font = [UIFont fontWithName:(NSString *) size:(CGFloat)];
fontWithName:后面使用CSS字体名称匹配的语义
size:使用字体大小
如何获取iOS系统里面字体样式方法如下:
for (NSString *str in [UIFont familyNames]) {
NSLog(@"UIFont_Name------------:%@",str);
}
打印出来的结果如下:
2016-04-07 10:52:50.135 XiaoYuanSanWei[302:18293] UIFont_Name------------:Copperplate
2016-04-07 10:52:50.135 XiaoYuanSanWei[302:18293] UIFont_Name------------:Heiti SC
2016-04-07 10:52:50.135 XiaoYuanSanWei[302:18293] UIFont_Name------------:Iowan Old Style
2016-04-07 10:52:50.135 XiaoYuanSanWei[302:18293] UIFont_Name------------:Kohinoor Telugu
2016-04-07 10:52:50.135 XiaoYuanSanWei[302:18293] UIFont_Name------------:Thonburi
2016-04-07 10:52:50.135 XiaoYuanSanWei[302:18293] UIFont_Name------------:Heiti TC
2016-04-07 10:52:50.135 XiaoYuanSanWei[302:18293] UIFont_Name------------:Courier New
2016-04-07 10:52:50.136 XiaoYuanSanWei[302:18293] UIFont_Name------------:Gill Sans
2016-04-07 10:52:50.136 XiaoYuanSanWei[302:18293] UIFont_Name------------:Apple SD Gothic Neo
2016-04-07 10:52:50.136 XiaoYuanSanWei[302:18293] UIFont_Name------------:Marker Felt
2016-04-07 10:52:50.136 XiaoYuanSanWei[302:18293] UIFont_Name------------:Avenir Next Condensed
2016-04-07 10:52:50.136 XiaoYuanSanWei[302:18293] UIFont_Name------------:Tamil Sangam MN
2016-04-07 10:52:50.136 XiaoYuanSanWei[302:18293] UIFont_Name------------:Helvetica Neue
2016-04-07 10:52:50.136 XiaoYuanSanWei[302:18293] UIFont_Name------------:Gurmukhi MN
2016-04-07 10:52:50.137 XiaoYuanSanWei[302:18293] UIFont_Name------------:Times New Roman
2016-04-07 10:52:50.137 XiaoYuanSanWei[302:18293] UIFont_Name------------:Georgia
2016-04-07 10:52:50.137 XiaoYuanSanWei[302:18293] UIFont_Name------------:Apple Color Emoji
2016-04-07 10:52:50.137 XiaoYuanSanWei[302:18293] UIFont_Name------------:Arial Rounded MT Bold
2016-04-07 10:52:50.137 XiaoYuanSanWei[302:18293] UIFont_Name------------:Kailasa
2016-04-07 10:52:50.137 XiaoYuanSanWei[302:18293] UIFont_Name------------:Kohinoor Devanagari
2016-04-07 10:52:50.137 XiaoYuanSanWei[302:18293] UIFont_Name------------:Kohinoor Bangla
2016-04-07 10:52:50.137 XiaoYuanSanWei[302:18293] UIFont_Name------------:Chalkboard SE
2016-04-07 10:52:50.137 XiaoYuanSanWei[302:18293] UIFont_Name------------:Sinhala Sangam MN
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:PingFang TC
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Gujarati Sangam MN
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Damascus
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Noteworthy
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Geeza Pro
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Avenir
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Academy Engraved LET
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Mishafi
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Futura
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Farah
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Kannada Sangam MN
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Arial Hebrew
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Arial
2016-04-07 10:52:50.138 XiaoYuanSanWei[302:18293] UIFont_Name------------:Party LET
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Chalkduster
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Hoefler Text
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Optima
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Palatino
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Lao Sangam MN
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Malayalam Sangam MN
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Al Nile
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Bradley Hand
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:PingFang HK
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Trebuchet MS
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Helvetica
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Courier
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Cochin
2016-04-07 10:52:50.139 XiaoYuanSanWei[302:18293] UIFont_Name------------:Hiragino Mincho ProN
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Devanagari Sangam MN
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Oriya Sangam MN
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Snell Roundhand
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Zapf Dingbats
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Bodoni 72
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Verdana
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:American Typewriter
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Avenir Next
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Baskerville
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Khmer Sangam MN
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Didot
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Savoye LET
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Bodoni Ornaments
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Symbol
2016-04-07 10:52:50.140 XiaoYuanSanWei[302:18293] UIFont_Name------------:Menlo
2016-04-07 10:52:50.141 XiaoYuanSanWei[302:18293] UIFont_Name------------:Bodoni 72 Smallcaps
2016-04-07 10:52:50.141 XiaoYuanSanWei[302:18293] UIFont_Name------------:Papyrus
2016-04-07 10:52:50.141 XiaoYuanSanWei[302:18293] UIFont_Name------------:Hiragino Sans
2016-04-07 10:52:50.141 XiaoYuanSanWei[302:18293] UIFont_Name------------:PingFang SC
2016-04-07 10:52:50.141 XiaoYuanSanWei[302:18293] UIFont_Name------------:Euphemia UCAS
2016-04-07 10:52:50.141 XiaoYuanSanWei[302:18293] UIFont_Name------------:Telugu Sangam MN
2016-04-07 10:52:50.141 XiaoYuanSanWei[302:18293] UIFont_Name------------:Bangla Sangam MN
2016-04-07 10:52:50.141 XiaoYuanSanWei[302:18293] UIFont_Name------------:Zapfino
2016-04-07 10:52:50.141 XiaoYuanSanWei[302:18293] UIFont_Name------------:Bodoni 72 Oldstyle
这打印出来的字体为iOS系统所支持的所有字体样式
各种字体设置的具体效果如下:
//上面的图片效果借鉴别人的,本人在此谢谢!
Bodoni 72 Oldstyle:
Zapfino:
Bangla Sangam MN:
Telugu Sangam MN: