Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom UIFont for preferredFontForTextStyle

Tags:

ios

How can I return a custom UIFont from preferredFontForTextStyle for each Text style?

e.g I want to use ArialHebrew-Bold font for UIFontTextStyleHeadline and use ArialHebrew for UIFontTextStyleBody

like image 929
Johan de Klerk Avatar asked Sep 26 '13 12:09

Johan de Klerk


1 Answers

If you just like dynamic font-size with your own font you can do this

UIFontDescriptor *userFont = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleBody]; float userFontSize = [userFont pointSize]; UIFont *font = [UIFont fontWithName:@"ArialHebrew-Bold" size:userFontSize]; 
like image 89
peko Avatar answered Oct 14 '22 13:10

peko