Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I preload custom fonts on iPhone to improve performance?

I've added the UIAppFonts entry on my info.plist to enable custom ttf fonts, it works fine. However when using the font there's also a delay in the UIView the first time it's called, is there a way to preload the fonts or some other technique to avoid this?

Thanks

like image 425
Chris Avatar asked Nov 14 '22 23:11

Chris


1 Answers

In your application delegate or some other place that is called when the application launches try creating a hidden UILabel that uses your custom font and remove it straight away. That way it will preload the font so that the next time you use a UILabel with that font it won't pay the first time penalty.

like image 81
DHamrick Avatar answered Dec 21 '22 07:12

DHamrick