Bound Text in TableView Performance Problem

iOS7 presented a wonderful text effect "letterpress", which was used by AttributedText to UILabel text. I need to have this effect in the cells of a simple table.

Unfortunately, in standard mode, it gave considerable scrolling compared with the "textLabel.text".

It seems that the text rendering is very expensive processor, but the built-in iOS apps such as Notes, scroll without delay. Is it possible to improve rendering performance?

Here is an example:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { MyCell *cell = (MyCell*)[tableView dequeueReusableCellWithIdentifier:identifier]; if (cell == nil) { cell = [[MyCell alloc] init]; } NSDictionary *attrs = @{NSTextEffectAttributeName : NSTextEffectLetterpressStyle}; NSString *text = [self textWithCell:indexPath]; //next line causes lags textLabel.attributedText = [[NSMutableAttributedString alloc] initWithString:text attributes:attrs]; //this works fine //cell.textLabel.text = text; } 
+6
source share

All Articles