AliSoftware / OHAttributedLabel

UILabel that supports NSAttributedString
https://github.com/AliSoftware/OHAttributedLabel/wiki
1.51k stars 344 forks source link

drawTextInRect is super slow when use with foreign letters in iOS7 #158

Closed kong707 closed 10 years ago

kong707 commented 10 years ago

This might due to bug from Apple. But I am not sure so I better ask it here.

My app scrolling performance is doing just fine in iOS6 . I have a label using OHAttributedLabel with dynamic height and content. But when I switch to iOS7 SDK. The scrolling performance drop drastically. I use profile tools and notice that the [OHAttributeLabel drawTextInRect] is expensive and causing the lag. This line of code is the problem

CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(cfAttrStrWithLinks);

But actually, if I try it with English content .Everything is fast. But with foreign text ,it turns out to be very slow. Any suggestions? I also tried to test with different font ( I set the custom uitableviewcell by interface builder) . But when it display the foreign text, it does not change at all.

AliSoftware commented 10 years ago

Unfortunately this is a problem with CTFramesetter and thus an issue with Apple CoreText.framework

kong707 commented 10 years ago

Thanks Ali, I still need to use OHAttributedLabel's features such as custom link for hashtag and url. So I am filing the bug to Apple right now.