다음 메서드는 배열의 데이터를 UITableView의 사용자 지정 셀로로드합니다. 데이터가 올바르게로드됩니다. 그러나 위의 셀 (셀이 보이지 않음)의 데이터를 스크롤하면 배열의 겉보기에 임의의 요소로 변경됩니다.처음에 올바르게로드 된 UITableView 셀
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
cellComments=nil;
cellComments=(FullCommentCell *)[tableView dequeueReusableCellWithIdentifier:FullCommentCell_ID];
if(cellComments==nil)
{
[[NSBundle mainBundle]loadNibNamed:@"FullCommentCell" owner:self options:nil];
}
NSString *row = [NSString stringWithFormat:@"#%i",indexPath.row+1];
[cellComments loadFullComments:[latestFMLComments objectAtIndex:(indexPath.row+1)] withCommentNumber:row];
//cellComments.userInteractionEnabled=NO;
return cellComments;
}
또한 셀을 클릭 할 때 다음과 같은 방법으로 처리합니다. 셀의 데이터가 배열의 임의의 요소로 바뀌면 - 셀을 클릭하면 (아래 메서드가 호출 됨) 셀의 데이터가 올바른 데이터로 변경됩니다.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self tableView:tableView cellForRowAtIndexPath:indexPath];
}
왜 이런 일이 일어나는가?
하위 뷰 요소를 재설정하면 어떻게됩니까? – zpesk