일부 정보를 표시하는 배지가있는 사용자 지정 셀이 있습니다. 일부 셀에만 배지 이미지와 텍스트를 설정하고 싶습니다 (웹 서비스 응답에서 가져 오는 일부 플래그에 따라 다름). 그러나 셀을 재사용하면 배지와 텍스트가 중복됩니다. 어떻게 해결 될 수 있습니다.셀 서브 뷰 UITableView에서 중복되는 문제
배지와 텍스트는 사용자 정의 셀의 일부이며 코드를 통해 하위보기로 추가되지 않습니다.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Cell configurations
[self setBadgeText:indexPath :deals];
return cell;
}
- (void) setBadgeText:(NSIndexPath *)indexPath withObject:(VBDeals *)deals
{
[self.tableView beginUpdates];
YourTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"cellIdentifier" forIndexPath:indexPath];]
if ([deals.dealType intValue] == PUNCHCARDDEAL)
{
if ([deals.punchStatus intValue] == UNIV_INDEX_ONE && ![VBUtility isNullValue:deals.punchSpecialMessage])
[cell.lblBadgeLabel setText:deals.punchSpecialMessage];
else
[cell.lblBadgeLabel setText:[self getBadgeTextForPCD:deals]];
}
[self.tableView endUpdates];
}
당신이 당신의 cellForRowAtIndexPath 코드를 게시 할 수 :
– Veeru