Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 366
user1832555 Avatar asked Nov 17 '12 21:11

user1832555


1 Answers

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/

like image 154
matsoftware Avatar answered Sep 22 '22 23:09

matsoftware