IOS加載自定義的字體須要點活兒
Xcode自帶字體樣式查詢:http://iosfonts.com/
1.下載所須要的ttf文件,導入工程中,在Info.plist
中添加一項:Fonts provided by application
,填寫字體文件名稱加後綴.如圖:ios
2.前往TARGETS -> Build Phases -> Copy Bundle Resources
中添加字體文件app
3.經過眼力找到字體文件對應的fontName
,暫未有更好的方法,若有請告知,謝謝~ide
NSArray *familyNames = [UIFont familyNames]; for( NSString *familyName in familyNames ) { NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName]; for( NSString *fontName in fontNames ) { printf( "\tFont: %s \n", [fontName UTF8String] ); } }
4.使用自定義字體字體
self.Label.text = @"鍾齊流江毛筆草體"; self.Label.font = [UIFont fontWithName:@"LiuJian-Mao-Cao-2.0" size:30]; self.Label2.text = @"蒙納漫畫體"; self.Label2.font = [UIFont fontWithName:@"MComicHK-Medium" size:30];
End.ui