Application really freeze while scrolling with NSAttributedString (When I use NSString it works fine), so there my method:
- (void)setSubtitleForCell:(TTTableViewCell *)cell item:(TTPhotoPost *)item
{
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:
[item.caption dataUsingEncoding:NSUnicodeStringEncoding]
options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType }
documentAttributes:nil
error:nil];
[cell.descriptionLabel setAttributedText:attributedString];
}
Any mistakes there? or some way to make att.string faster?
I'd suggest creating the NSAttributedString
from HTML once asynchronously, and storing the attributed string in your model. That way you won't have to do the HTML -> attributed string conversion on every cell reuse, which happens a lot when you're scrolling.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With