代码:
- (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; }
输出:
2014-12-02 13:31:15.594 iphone开发之获取系统字体[11349:60b] --系统的所有字体--(
"Thonburi-Bold",
Thonburi,
"Thonburi-Light",
"SnellRoundhand-Black",
"SnellRoundhand-Bold",
SnellRoundhand,
AcademyEngravedLetPlain,
"MarkerFelt-Thin",
"MarkerFelt-Wide",
"Avenir-Heavy",
"Avenir-Oblique",
"Avenir-Black",
"Avenir-Book",
"Avenir-BlackOblique",
"Avenir-HeavyOblique",
"Avenir-Light",
"Avenir-MediumOblique",
"Avenir-Medium",
"Avenir-LightOblique",
"Avenir-Roman",
"Avenir-BookOblique",
"GeezaPro-Bold",
GeezaPro,
"GeezaPro-Light",
ArialRoundedMTBold,
"Trebuchet-BoldItalic",
TrebuchetMS,
"TrebuchetMS-Bold",
"TrebuchetMS-Italic",
ArialMT,
"Arial-BoldItalicMT",
"Arial-ItalicMT",
"Arial-BoldMT",
"Marion-Regular",
"Marion-Italic",
"Marion-Bold",
"Menlo-BoldItalic",
"Menlo-Regular",
"Menlo-Bold",
"Menlo-Italic",
MalayalamSangamMN,
"MalayalamSangamMN-Bold",
KannadaSangamMN,
"KannadaSangamMN-Bold",
"GurmukhiMN-Bold",
GurmukhiMN,
"BodoniSvtyTwoOSITCTT-BookIt",
"BodoniSvtyTwoOSITCTT-Bold",
"BodoniSvtyTwoOSITCTT-Book",
"BradleyHandITCTT-Bold",
"Cochin-Bold",
"Cochin-BoldItalic",
"Cochin-Italic",
Cochin,
SinhalaSangamMN,
"SinhalaSangamMN-Bold",
"HiraKakuProN-W6",
"HiraKakuProN-W3",
"IowanOldStyle-Bold",
"IowanOldStyle-BoldItalic",
"IowanOldStyle-Italic",
"IowanOldStyle-Roman",
DamascusBold,
Damascus,
DamascusMedium,
DamascusSemiBold,
"AlNile-Bold",
AlNile,
Farah,
"Papyrus-Condensed",
Papyrus,
"Verdana-BoldItalic",
"Verdana-Italic",
Verdana,
"Verdana-Bold",
ZapfDingbatsITC,
"DINCondensed-Bold",
"AvenirNextCondensed-Regular",
"AvenirNextCondensed-MediumItalic",
"AvenirNextCondensed-UltraLightItalic",
"AvenirNextCondensed-UltraLight",
"AvenirNextCondensed-BoldItalic",
"AvenirNextCondensed-Italic",
"AvenirNextCondensed-Medium",
"AvenirNextCondensed-HeavyItalic",
"AvenirNextCondensed-Heavy",
"AvenirNextCondensed-DemiBoldItalic",
"AvenirNextCondensed-DemiBold",
"AvenirNextCondensed-Bold",
Courier,
"Courier-Oblique",
"Courier-BoldOblique",
"Courier-Bold",
"HoeflerText-Regular",
"HoeflerText-BlackItalic",
"HoeflerText-Italic",
"HoeflerText-Black",
EuphemiaUCAS,
"EuphemiaUCAS-Bold",
"EuphemiaUCAS-Italic",
"Helvetica-Oblique",
"Helvetica-Light",
"Helvetica-Bold",
Helvetica,
"Helvetica-BoldOblique",
"Helvetica-LightOblique",
"HiraMinProN-W6",
"HiraMinProN-W3",
BodoniOrnamentsITCTT,
"Superclarendon-Regular",
"Superclarendon-BoldItalic",
"Superclarendon-Light",
"Superclarendon-BlackItalic",
"Superclarendon-Italic",
"Superclarendon-LightItalic",
"Superclarendon-Bold",
"Superclarendon-Black",
DiwanMishafi,
"Optima-Regular",
"Optima-Italic",
"Optima-Bold",
"Optima-BoldItalic",
"Optima-ExtraBlack",
"GujaratiSangamMN-Bold",
GujaratiSangamMN,
DevanagariSangamMN,
"DevanagariSangamMN-Bold",
AppleColorEmoji,
SavoyeLetPlain,
Kailasa,
"Kailasa-Bold",
"TimesNewRomanPS-BoldItalicMT",
TimesNewRomanPSMT,
"TimesNewRomanPS-BoldMT",
"TimesNewRomanPS-ItalicMT",
TeluguSangamMN,
"TeluguSangamMN-Bold",
"STHeitiSC-Medium",
"STHeitiSC-Light",
"AppleSDGothicNeo-Thin",
"AppleSDGothicNeo-SemiBold",
"AppleSDGothicNeo-Medium",
"AppleSDGothicNeo-Regular",
"AppleSDGothicNeo-Bold",
"AppleSDGothicNeo-Light",
"Futura-Medium",
"Futura-CondensedMedium",
"Futura-MediumItalic",
"Futura-CondensedExtraBold",
"BodoniSvtyTwoITCTT-Book",
"BodoniSvtyTwoITCTT-Bold",
"BodoniSvtyTwoITCTT-BookIta",
"Baskerville-Bold",
"Baskerville-SemiBoldItalic",
"Baskerville-BoldItalic",
Baskerville,
"Baskerville-SemiBold",
"Baskerville-Italic",
Symbol,
"STHeitiTC-Medium",
"STHeitiTC-Light",
Copperplate,
"Copperplate-Light",
"Copperplate-Bold",
PartyLetPlain,
"AmericanTypewriter-Light",
"AmericanTypewriter-CondensedLight",
"AmericanTypewriter-CondensedBold",
AmericanTypewriter,
"AmericanTypewriter-Condensed",
"AmericanTypewriter-Bold",
"ChalkboardSE-Light",
"ChalkboardSE-Regular",
"ChalkboardSE-Bold",
"AvenirNext-MediumItalic",
"AvenirNext-Bold",
"AvenirNext-UltraLight",
"AvenirNext-DemiBold",
"AvenirNext-HeavyItalic",
"AvenirNext-Heavy",
"AvenirNext-Medium",
"AvenirNext-Italic",
"AvenirNext-UltraLightItalic",
"AvenirNext-BoldItalic",
"AvenirNext-Regular",
"AvenirNext-DemiBoldItalic",
BanglaSangamMN,
"BanglaSangamMN-Bold",
"Noteworthy-Bold",
"Noteworthy-Light",
Zapfino,
TamilSangamMN,
"TamilSangamMN-Bold",
Chalkduster,
"ArialHebrew-Bold",
"ArialHebrew-Light",
ArialHebrew,
"Georgia-BoldItalic",
"Georgia-Bold",
"Georgia-Italic",
Georgia,
"HelveticaNeue-BoldItalic",
"HelveticaNeue-Light",
"HelveticaNeue-Italic",
"HelveticaNeue-UltraLightItalic",
"HelveticaNeue-CondensedBold",
"HelveticaNeue-MediumItalic",
"HelveticaNeue-Thin",
"HelveticaNeue-Medium",
"HelveticaNeue-ThinItalic",
"HelveticaNeue-LightItalic",
"HelveticaNeue-UltraLight",
"HelveticaNeue-Bold",
HelveticaNeue,
"HelveticaNeue-CondensedBlack",
GillSans,
"GillSans-Italic",
"GillSans-BoldItalic",
"GillSans-Light",
"GillSans-LightItalic",
"GillSans-Bold",
"Palatino-Roman",
"Palatino-Italic",
"Palatino-Bold",
"Palatino-BoldItalic",
CourierNewPSMT,
"CourierNewPS-BoldMT",
"CourierNewPS-ItalicMT",
"CourierNewPS-BoldItalicMT",
OriyaSangamMN,
"OriyaSangamMN-Bold",
"Didot-Bold",
"Didot-Italic",
Didot,
"DINAlternate-Bold",
"BodoniSvtyTwoSCITCTT-Book"
)
2014-12-02 13:31:15.606 iphone开发之获取系统字体[11349:60b] --系统当前字体--<UICTFont: 0x8c98000> font-family: ".HelveticaNeueInterface-Regular"; font-weight: normal; font-style: normal; font-size: 14.00pt