Chris
Chris

Reputation: 2488

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

Upvotes: 5

Views: 1100

Answers (1)

DHamrick
DHamrick

Reputation: 8488

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.

Upvotes: 1

Related Questions