Is there a faster way to draw text?

Posted by mystify on Stack Overflow See other posts from Stack Overflow or by mystify
Published on 2010-05-28T16:53:50Z Indexed on 2010/05/28 17:02 UTC
Read the original article Hit count: 174

Filed under:

Shark complains about a big performance hit with this line, which takes like 80% of CPU time. I have a counter that is updated very frequently and performance seriously sucks.

It's an custom UILabel subclass with -drawRect: implemented. Every time the counter value changes, this is used to draw the new text:

[self.text drawInRect:textRect withFont:correctedFont lineBreakMode:self.lineBreakMode alignment:self.textAlignment];

When I comment this line out, performance rocks. Its smooth and fast. So Shark isn't wrong about this. But what could I do to improve this? Maybe go a level deeper? Does that make any sense?

Probably drawing text is really so incredible heavy...?

© Stack Overflow or respective owner

Related posts about iphone