I would like to use the font "Avenir" which is included in iOS 6. Does that mean a device running iOS 5 won't be able to see the font? If so, is there a way to fallback on a different font if "Avenir" isn't available on their device?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can choose the font you want to be used in iOS < 6 and assign it if necessary. Define a macro like this:
#define SYSTEM_VERSION_LESS_THAN(v)
([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
and then you can do in your code:
NSString *fontName = @"Avenir";
if SYSTEM_VERSION_LESS_THAN(6.0) {
fontName = @"ArialMT";
}
You can find a list of supported fonts here: http://iosfonts.com/