What is the most performant way to render fast changing text (10-15 numbers that change every single frame) in iOS? Those are the tries that I did so far:
1) CATextLayer
+ CTFont
and NSString
: Quite fast but no access to kerning, which I need. (If somebody knows a trick how to get kerning to work with CTFont
and without NSAttributedString
, that'd also be cool, but it's not the main question ;) )
2) CATextLayer
+ NSAttributedString
: Slow and laggy. I see huge FPS drops compared to 1). In my app this change lets the FPS drop from 50-60 to 30.
3) Bitmap Fonts, using UIImageViews
and UIImage
to display the numbers: Quite fast as well, though not really satisfying as there should be a better way / a more natural way in iOS to render fonts efficiently.
EDIT:
4) UILabel
+ NSString
- Quite Fast, but again no access to kerning.
5) UILabel
+ NSAttributedString
- Slow and laggy again.
Rendering an NSAttributedString
is a lot slower than rendering a basic NSString
. This is really frustrating as all I need from NSAttributedString
at the moment is the spacing between letters.
CFAttributedString
to apply kerning withCTFont
? – Dolley