UITableView卡顿问题处理
1、
1 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; |
这个代理方法每次滑动都会调用 建议不要在里面做耗时操作
eg:重新计算高度
1 | CGSize strSize = [str boundingRectWithSize:CGSizeMake(BHSCREEN_W - 32, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:BH14Font} context:nil].size; |
2、富文本串AttributeString的绘制也很耗时
1 | NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:str]; |