Can we use a font in iOS 6 if it's not included in iOS 5?

本秂侑毒 提交于 2019-12-21 12:08:36

问题


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/



来源:https://stackoverflow.com/questions/13434895/can-we-use-a-font-in-ios-6-if-its-not-included-in-ios-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!