-1
이전 질문과 중복 될 수 있지만 내 기록이 왜 복제되는지 알 수 없습니다. 테이블이 행을 재활용하려고 시도한다는 것을 알고 있습니다. 테이블이 테이블에 삽입 된 모든 데이터 조각에 대해 더 많은 셀을 추가하는 것처럼 보입니다.UITableView에서 중복 됨
예를 들어 2 레코드의 경우 4 행을 얻습니다. 3 레코드의 경우 9 행을 얻습니다. 여기
코드 :
UITable 위임 물건 :
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
return nil;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return letters.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return letters.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
printf("%li", (long)indexPath.row);
[cell textLabel].text = [letters objectAtIndex:indexPath.row];
return cell;
}
나는 데이터가 이미 먼저 표시되었는지 확인해야합니까?