码迷,mamicode.com
首页 > 移动开发 > 详细

ios字体设置

时间:2015-10-10 12:12:38      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:

ios中的字体:

    字体是图形用户界面显示文本的基础。Cocoa在UIKit框架中为开发者提供了高层次的API以及方便的枚举、加载和使用字体。Cocoa Touch 使用UIFont 类来封装字体。每个ios设备都内置了系统字体。字体被组织成字体族科(Families),每个族科又包含字样(Faces)。例如,Helvetica 是一个字体族科,Helvetica Bold是Helvetica族科中的一个字样。要加载字体,你必须知道字体的字样(字体的名字),要知道字样,你必须知道它的族科。怎么获取系统字体的族科呢,我们可以循环输出系统字体族科,使用UIFont类的familyNames类方法,通过这个类方法得到字体族科名字然后用UIFont类的fontNamesForFamilyName:类方法,传递family name作为参数,并返回一个字体名称的数组(array):

- (void)enumerateFonts{  
      for(NSString *familyName in [UIFont familyNames]){  
      NSLog(@"Font FamilyName = %@",familyName); //*输出字体族科名字  
  
        for(NSString *fontName in [UIFont fontNamesForFamilyName:familyName]){  
            NSLog(@"\t%@",fontName);         //*输出字体族科下字样名字  
        }  
    }  
}  

  

在ios模拟器上运行代码,得到如下结果:

...
Font Family = Geeza Pro
GeezaPro
GeezaPro-Bold
Font Family = Helvetica Neue
HelveticaNeue-Italic
HelveticaNeue-Bold
HelveticaNeue-BoldItalic
HelveticaNeue

...

字体族科后面加-Bold就是加粗 加-Oblique就是倾斜等

 

 

iPhone 5.0 iPad 5.0
Font Families: 58 Font Families: 58
Academy Engraved LET
AcademyEngravedLetPlain AcademyEngravedLetPlain
American Typewriter
AmericanTypewriter-CondensedLight AmericanTypewriter-CondensedLight
AmericanTypewriter-Light AmericanTypewriter-Light
AmericanTypewriter AmericanTypewriter
AmericanTypewriter-Condensed AmericanTypewriter-Condensed
AmericanTypewriter-Bold AmericanTypewriter-Bold
AmericanTypewriter-CondensedBold AmericanTypewriter-CondensedBold
Apple Color Emoji
AppleColorEmoji AppleColorEmoji
Apple SD Gothic Neo
AppleSDGothicNeo-Medium AppleSDGothicNeo-Medium
AppleSDGothicNeo-Bold AppleSDGothicNeo-Bold
Arial
ArialMT ArialMT
Arial-ItalicMT Arial-ItalicMT
Arial-BoldMT Arial-BoldMT
Arial-BoldItalicMT Arial-BoldItalicMT
Arial Hebrew
ArialHebrew ArialHebrew
ArialHebrew-Bold ArialHebrew-Bold
Arial Rounded MT Bold
ArialRoundedMTBold ArialRoundedMTBold
Bangla Sangam MN
BanglaSangamMN-Bold BanglaSangamMN-Bold
BanglaSangamMN BanglaSangamMN
Baskerville
Baskerville Baskerville
Baskerville-Italic Baskerville-Italic
Baskerville-SemiBold Baskerville-SemiBold
Baskerville-SemiBoldItalic Baskerville-SemiBoldItalic
Baskerville-Bold Baskerville-Bold
Baskerville-BoldItalic Baskerville-BoldItalic
Bodoni 72
BodoniSvtyTwoITCTT-Book BodoniSvtyTwoITCTT-Book
BodoniSvtyTwoITCTT-BookIta BodoniSvtyTwoITCTT-BookIta
BodoniSvtyTwoITCTT-Bold BodoniSvtyTwoITCTT-Bold
Bodoni 72 Oldstyle
BodoniSvtyTwoOSITCTT-Book BodoniSvtyTwoOSITCTT-Book
BodoniSvtyTwoOSITCTT-BookIt BodoniSvtyTwoOSITCTT-BookIt
BodoniSvtyTwoOSITCTT-Bold BodoniSvtyTwoOSITCTT-Bold
Bodoni 72 Smallcaps
BodoniSvtyTwoSCITCTT-Book BodoniSvtyTwoSCITCTT-Book
Bodoni Ornaments
BodoniOrnamentsITCTT BodoniOrnamentsITCTT
Bradley Hand
BradleyHandITCTT-Bold BradleyHandITCTT-Bold
Chalkboard SE
ChalkboardSE-Light ChalkboardSE-Light
ChalkboardSE-Regular ChalkboardSE-Regular
ChalkboardSE-Bold ChalkboardSE-Bold
Chalkduster
Chalkduster Chalkduster
Cochin
Cochin Cochin
Cochin-Italic Cochin-Italic
Cochin-Bold Cochin-Bold
Cochin-BoldItalic Cochin-BoldItalic
Copperplate
Copperplate-Light Copperplate-Light
Copperplate Copperplate
Copperplate-Bold Copperplate-Bold
Courier
Courier Courier
Courier-Oblique Courier-Oblique
Courier-Bold Courier-Bold
Courier-BoldOblique Courier-BoldOblique
Courier New
CourierNewPSMT CourierNewPSMT
CourierNewPS-BoldMT CourierNewPS-BoldMT
CourierNewPS-BoldItalicMT CourierNewPS-BoldItalicMT
CourierNewPS-ItalicMT CourierNewPS-ItalicMT
DB LCD Temp
DBLCDTempBlack DBLCDTempBlack
Devanagari Sangam MN
DevanagariSangamMN DevanagariSangamMN
DevanagariSangamMN-Bold DevanagariSangamMN-Bold
Didot
Didot Didot
Didot-Italic Didot-Italic
Didot-Bold Didot-Bold
Euphemia UCAS
EuphemiaUCAS EuphemiaUCAS
EuphemiaUCAS-Italic EuphemiaUCAS-Italic
EuphemiaUCAS-Bold EuphemiaUCAS-Bold
Futura
Futura-Medium Futura-Medium
Futura-MediumItalic Futura-MediumItalic
Futura-CondensedMedium Futura-CondensedMedium
Futura-CondensedExtraBold Futura-CondensedExtraBold
Geeza Pro
GeezaPro GeezaPro
GeezaPro-Bold GeezaPro-Bold
Georgia
Georgia Georgia
Georgia-Italic Georgia-Italic
Georgia-Bold Georgia-Bold
Georgia-BoldItalic Georgia-BoldItalic
Gill Sans
GillSans-Light GillSans-Light
GillSans-LightItalic GillSans-LightItalic
GillSans GillSans
GillSans-Italic GillSans-Italic
GillSans-Bold GillSans-Bold
GillSans-BoldItalic GillSans-BoldItalic
Gujarati Sangam MN
GujaratiSangamMN GujaratiSangamMN
GujaratiSangamMN-Bold GujaratiSangamMN-Bold
Gurmukhi MN
GurmukhiMN GurmukhiMN
GurmukhiMN-Bold GurmukhiMN-Bold
Heiti SC
STHeitiSC-Light STHeitiSC-Light
STHeitiSC-Medium STHeitiSC-Medium
Heiti TC
STHeitiTC-Light STHeitiTC-Light
STHeitiTC-Medium STHeitiTC-Medium
Helvetica
Helvetica-Light Helvetica-Light
Helvetica-LightOblique Helvetica-LightOblique
Helvetica Helvetica
Helvetica-Oblique Helvetica-Oblique
Helvetica-Bold Helvetica-Bold
Helvetica-BoldOblique Helvetica-BoldOblique
Helvetica Neue
HelveticaNeue-UltraLight HelveticaNeue-UltraLight
HelveticaNeue-UltraLightItalic HelveticaNeue-UltraLightItalic
HelveticaNeue-Light HelveticaNeue-Light
HelveticaNeue-LightItalic HelveticaNeue-LightItalic
HelveticaNeue HelveticaNeue
HelveticaNeue-Italic HelveticaNeue-Italic
HelveticaNeue-Medium HelveticaNeue-Medium
HelveticaNeue-Bold HelveticaNeue-Bold
HelveticaNeue-BoldItalic HelveticaNeue-BoldItalic
HelveticaNeue-CondensedBold HelveticaNeue-CondensedBold
HelveticaNeue-CondensedBlack HelveticaNeue-CondensedBlack
Hiragino Kaku Gothic ProN
HiraKakuProN-W3 HiraKakuProN-W3
HiraKakuProN-W6 HiraKakuProN-W6
Hiragino Mincho ProN
HiraMinProN-W3 HiraMinProN-W3
HiraMinProN-W6 HiraMinProN-W6
Hoefler Text
HoeflerText-Regular HoeflerText-Regular
HoeflerText-Italic HoeflerText-Italic
HoeflerText-Black HoeflerText-Black
HoeflerText-BlackItalic HoeflerText-BlackItalic
Kailasa
Kailasa Kailasa
Kailasa-Bold Kailasa-Bold
Kannada Sangam MN
KannadaSangamMN KannadaSangamMN
KannadaSangamMN-Bold KannadaSangamMN-Bold
Malayalam Sangam MN
MalayalamSangamMN MalayalamSangamMN
MalayalamSangamMN-Bold MalayalamSangamMN-Bold
Marion
Marion-Regular Marion-Regular
Marion-Italic Marion-Italic
Marion-Bold Marion-Bold
Marker Felt
MarkerFelt-Thin MarkerFelt-Thin
MarkerFelt-Wide MarkerFelt-Wide
Noteworthy
Noteworthy-Light Noteworthy-Light
Noteworthy-Bold Noteworthy-Bold
Optima
Optima-Italic Optima-Italic
Optima-Regular Optima-Regular
Optima-Bold Optima-Bold
Optima-BoldItalic Optima-BoldItalic
Optima-ExtraBlack Optima-ExtraBlack
Oriya Sangam MN
OriyaSangamMN OriyaSangamMN
OriyaSangamMN-Bold OriyaSangamMN-Bold
Palatino
Palatino-Roman Palatino-Roman
Palatino-Italic Palatino-Italic
Palatino-Bold Palatino-Bold
Palatino-BoldItalic Palatino-BoldItalic
Papyrus
Papyrus Papyrus
Papyrus-Condensed Papyrus-Condensed
Party LET
PartyLetPlain PartyLetPlain
Sinhala Sangam MN
SinhalaSangamMN SinhalaSangamMN
SinhalaSangamMN-Bold SinhalaSangamMN-Bold
Snell Roundhand
SnellRoundhand SnellRoundhand
SnellRoundhand-Bold SnellRoundhand-Bold
SnellRoundhand-Black SnellRoundhand-Black
Tamil Sangam MN
TamilSangamMN TamilSangamMN
TamilSangamMN-Bold TamilSangamMN-Bold
Telugu Sangam MN
TeluguSangamMN TeluguSangamMN
TeluguSangamMN-Bold TeluguSangamMN-Bold
Thonburi
Thonburi Thonburi
Thonburi-Bold Thonburi-Bold
Times New Roman
TimesNewRomanPSMT TimesNewRomanPSMT
TimesNewRomanPS-ItalicMT TimesNewRomanPS-ItalicMT
TimesNewRomanPS-BoldMT TimesNewRomanPS-BoldMT
TimesNewRomanPS-BoldItalicMT TimesNewRomanPS-BoldItalicMT
Trebuchet MS
TrebuchetMS TrebuchetMS
TrebuchetMS-Italic TrebuchetMS-Italic
TrebuchetMS-Bold TrebuchetMS-Bold
Trebuchet-BoldItalic Trebuchet-BoldItalic
Verdana
Verdana Verdana
Verdana-Italic Verdana-Italic
Verdana-Bold Verdana-Bold
Verdana-BoldItalic Verdana-BoldItalic
Zapf Dingbats
ZapfDingbatsITC ZapfDingbatsITC
Zapfino
Zapfino Zapfino

 

 

原文:http://blog.sina.com.cn/s/blog_b22973cf0101auqv.html

 

ios字体设置

标签:

原文地址:http://www.cnblogs.com/maple023/p/4866217.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!