TableView가 깜박 거리는 문제에 관여했습니다. loadmore에 의해 tableview에 데이터를 추가 할 때 TableView가 깜박입니다. 이 코드를 사용하면 모든 것이 잘됩니다.IOS에 추가 된 데이터에 TableView가 추가로 깜박임
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 400;
}
그러나 각 행의 높이를 계산하고 있습니다. 각 행 높이가 같지 않기 때문입니다. 그런 다음 해당 코드를 적용한 후 My 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;
}
내가 누락 된 부분을 확인해 주시겠습니까?
여기서 문제는 당신이 CPU를 많이 작업을 행이 표시 되려고 할 때마다 수행하는 것을 당신
, 그 방법은 당신의 jQuery과의 모든 행에 대해 호출을 당신은 CPU 집약적 인 작업 위스콘신 수행 th : CGSize expectedSize = [[self plainTextFromHTMLText : wallComnt.contentTextHTML] sizeWithFont : [UIFont fontWithName : FontNameArial size : 15] constrainedToSize : maximumLabelSize lineBreakMode : NSLineBreakByWordWrapping]; 제 조언은 모든 행의 크기를 미리 평가하고 테이블 뷰에서 액세스 할 수있는 객체에 해당 정보를 저장하는 것입니다. heightForRowAtIndexPath : – Lolloz89
willDisplayCell 메소드를 구현 한 적이 있습니까? – ZeMoon
@ Lolloz89 예, 시간이 걸립니다. 그것을 고칠 다른 방법이 있습니까? –