테이블보기가있는 iOS 앱이 있습니다. 행을 여러 번 선택하면 선택한 정보가 중복됩니다.UITableView에서 중복 된 텍스트
당신은 사진을 볼 수 있습니다
나는이 방법으로 세포의 추가
- (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];
}
// Configure the cell...
UILabel *label = [[UILabel alloc] init];
Place *item = [source objectAtIndex:indexPath.row];
[label setFont:[UIFont fontWithName:@"PermianSansTypeface" size:15.0]];
label.text =item.name;
label.frame = CGRectMake(5, 5, 310, 35);
[cell addSubview:label];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
OnePlaceViewController *placeView = [[OnePlaceViewController alloc] initWithNibName:@"OnePlaceViewController" bundle:nil];
placeView.nom = indexPath.row;
placeView.source = source;
placeView.route = route;
placeView.titleView = titleView;
/*
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.selected = NO;
*/
[self.navigationController pushViewController:placeView animated:YES];
}
왜 정보를 복제 할 수 있습니까? Thnx.
나는 수정 구슬을 집에두고 왔기 때문에 코드를 게시해야합니다. –
몇 가지 코드를 추가하십시오. 그것을 봐주십시오 –
@EvanMulawski 권자 ...하지만 첫 번째 추측에, 그것은 세포 재사용 문제가있는 것 같다. 더 나은 대답을 위해서는'cellForRowAtIndex'와'didSelectRowAtIndex' 둘 다 필요합니다. – tipycalFlow