我参与了 TableView 闪烁问题。当我通过 loadmore 在 tableview 中附加数据时,TableView 正在闪烁。如果我使用此代码,那么一切都很好。
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 400;
}
但我正在计算每一行的高度。因为每一行的高度都不一样。然后我正在使用该代码,应用该代码后,我的 TableView 正在闪烁。
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableArray *temp;
if(_buddyWallSection)
temp = arrayBuddyList;
else
temp = arrayMyWallList;
CGFloat height = 320;
if( [[temp objectAtIndex:indexPath.row/2] isKindOfClass:[NSString class]] )
{
return height;
}
CGSize maximumLabelSize = CGSizeMake(280,9999);
GolferWall *wallComnt = [temp objectAtIndex:indexPath.row/2];
CGSize expectedSize = [[self plainTextFromHTMLText:wallComnt.contentTextHTML]sizeWithFont:[UIFont fontWithName:FontNameArial size:15] constrainedToSize:maximumLabelSize lineBreakMode:NSLineBreakByWordWrapping];
height = expectedSize.height;
NSLog(@"expected size %f", height);
if(wallComnt.imageNames.count == 0)
return 130 + ( height);
if ( height < 100 )
{
height = 350;
}
else
height = height * 2 ;
return height;
}
请检查一下我遗漏了什么?
谢谢