왜 그런지 모르겠지만 UITableView는 놀라운 것이 아니며 반복해서 표시해야합니다.내 UITableView에 행이 중복되어 있습니다.
사용자가 스크롤 할 때 추가되는 행 (예 : 화면 외부의 행)이 잘못된 행 색인의 데이터를 가져 오는 것 같습니다. 거의 새로운 셀이 대기열에서 빠져 나왔을 때 사용 된 셀을 사용하고 있지만 올바르게 정리되지 않았습니다.
대기열에있는 셀을 정리하여 새 셀에 이미 생성 된 셀을 사용하지 않아야합니까?
내 코드는 다음과 같습니다 :이 코드를 잘못 아무것도
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CustomCellIdentifier = @"CustomCellIdentifier";
MyDayCell *cell = (MyDayCell *)[tableView
dequeueReusableCellWithIdentifier: CustomCellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MyDayCell" owner:self options:nil];
for (id oneObject in nib)
if ([oneObject isKindOfClass:[MyDayCell class]])
cell = (MyDayCell *)oneObject;
}
NSUInteger section = [indexPath section];
NSUInteger row = [indexPath row];
NSArray *thisSectionItems = (NSArray*)[self.listData objectForKey: [[NSNumber alloc] initWithInt:section]];
MyDayDetails *rowData = [thisSectionItems objectAtIndex:row];
//setup my cells data here...
return cell;
}
있습니까?
누구나 전에 이런 걸 본 적이 있습니까?
그래, 이해가된다. 그리고 내가 구현 한 것, 그 덕분이다. – Mark