dequeueReusableCellWithIdentifier 메소드가 oldCell을 가져 오는 중 하나를 사용하는 경우 새로운 것을 생성하는 대신 사용할 수있는 경우이를 읽습니다. 이미지와 같이 표시 할 특별한 뷰가있는 경우 셀프가 오래된 그래픽이있는 셀을 사용하지 않고 결국 이미지를 얻지 못하도록 셀에 대해 show = YES 또는 show = NO라고 명시 적으로 말하고 싶습니다. 내 견해.UITableView dequeuReuseableCellWithIdentifier, 그래픽이 나타나지 않을 때 나타납니다.
그래서이 경우에는 popover 내부에 UITableView가 있습니다. 그룹화 된 테이블입니다. 그룹에는 데이터에 따라 2 ~ 4 개의 셀이 있습니다. 연락처 응용 프로그램처럼 UITableViewCellStyleValue2를 사용하고 있습니다. 데이터에 따라 그룹의 첫 번째 셀에서 셀의 오른쪽에 이미지를 추가하고 싶습니다. 그러나 일단 표를 스크롤하면 대기열에있는 셀을 집어 내고 첫 번째 셀이 아닌 셀의 오른쪽에있는 이미지 중 하나를 가져옵니다. UITableViewCell 하위 클래스를 만들지 않았고이 점을 추가해야하는지 확신 할 수 없으므로 이미지 뷰를 제어 할 수 있으므로 셀에 추가하고 있습니다.
그래서 여기 cellForRowAtIndexPath 방법의 중요한 부분 :
if (row == 0) {
UIImage *dot;
if (aTarget.importance == TargetImportanceHigh) {
dot = [UIImage imageNamed:@"dot_red.png"];
}
else if (aTarget.importance == TargetImportanceLow) {
dot = [UIImage imageNamed:@"dot_yellow.png"];
}
else {
dot = [UIImage imageNamed:@"dot_black.png"];
}
UIImageView *imgView = [[UIImageView alloc] initWithImage:dot];
imgView.frame = CGRectMake(cell.frame.size.width - 50, cell.frame.size.height/2 - 7.5, 15, 15);
[cell.contentView addSubview:imgView];
[imgView release];
cell.textLabel.text = @"Location
cell.detailTextLabel.text = [NSString stringWithFormat:@"%i", aTarget.location];
}
else if (row == 1) {
cell.textLabel.text = @"Coordinate";
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@", aTarget.coordinate];
}
return cell;