I have one font named ArnovalTCStd.otf which I want to use in my iPad application for some labels. How can I do it ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
There hasn’t been an easy way to add custom fonts to your iPhone applications. As of iOS 4 it has become very easy to do. Here is what you need to do in order to add custom fonts:
Check How to include ttf fonts to iOS app
回答2:
Please make sure that your font is supported for iPad. Please use following loop to identify list of Font Family
for (NSString *familyName in [UIFont familyNames])
{
NSLog(@"Font Family = %@", familyName);
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]){
NSLog(@"\t%@", fontName);
}
}
回答3:
Copy your fonts in application's resources folder.
in info.plist file
add new row with name
Fonts provided by application it will be of type array
add item in it.
write your font name in item's value
example:-Birch.TTF
than in your code write following line:-
[label1 setFont:[UIFont fontWithName:@"Birch" size:36.0]];