Bad scroll error UITableView iOS 7

I have a UITableView that contains more than 20 rows, each UITableViewCell contains a UITextView, which I can set for different UIFont, alignment and color. When I scroll down or up, while scrolling, there is a hang or lag, when I delete the font, text colors and alignment, everything becomes perfect. Has Apple changed the way text is redrawn in iOS 7? This did not happen with previous versions of iOS.

shows that the time spent on dequeueReusableCellWithIdentifier:forIndexPath:

- UPDATE Add code

if (unit.fontName != nil ) {
            textView.font = [UIFont fontWithName:unit.fontName size:unit.fontSize.floatValue];
        }
        if (unit.fontColor) {
            textView.textColor=[self convertString:unit.fontColor];
        }
        else {
            textView.textColor=[UIColor colorWithRed:0 green:0 blue:0 alpha:1];
        }
        if ([unit.fontSize floatValue] !=0) {
            textView.font = [UIFont fontWithName:textView.font.fontName size:[unit.fontSize floatValue]];
        }
        if (unit.textAlignment) {

            switch ([summaryUnit.textAlignment intValue]) {
                case 0:
                    textView.textAlignment = NSTextAlignmentLeft;
                    break;

                case 1:
                    textView.textAlignment = NSTextAlignmentCenter;
                    break;

                case 2:
                    textView.textAlignment = NSTextAlignmentRight;
                    break;

                default:
                    break;
            }

        }
+4
source share
1 answer

UITableView , , , .

tableView:heightForRowAtIndexPath:, UITableView , , . , .

, , . . , , .

, UITableView.

1) , , . . , UITableView .

2) . , UIView ( - ) - prepareForReuse. reset , , UITableView.

3) . , , , .

4) tableView:cellForRowAtIndexPath:. . tableView:willDisplayCell:forRowAtIndexPath:.

, , . , prepareForReuse. . reset . , dequeueReusableCellWithIdentifier:forIndexPath: .

, - ( , ), , shouldRasterize rasterizationScale CALayer . .

, - , .

EDIT:

PS. . Apple iOS 7. UITextView?!? , , , , UITextField UILabel. , . UITextView , (, Notes). , .

+15

Source: https://habr.com/ru/post/1534423/


All Articles