저는 iPhone 개발에 새로운입니다. 셀 내부에 레이블이있는 tableview가있는 응용 프로그램을 개발 중입니다. 나는 이것을 한 각 셀 행에 대해 이렇게 if(indexpath.row == 0)
처럼 각 행마다 다른 레이블을 붙였다. 그러나 테이블 뷰를 스크롤 할 때 레이블이 섞여 있습니다. 제발 도와주세요! 당신이 cell== nil
상태를 확인하기 전에 cell=nil;
을 넣어 또는 셀마다 시간을 만들 수 있습니다이 문제를 해결하기 위해내 tableview 셀 레이블을 제어하는 방법?
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if (indexPath.row == 2)
{
pendingListNumberLabel = [[UILabel alloc] init];
pendingListNumberLabel.font = [UIFont fontWithName:@"Helvetica" size:14];
pendingListNumberLabel.textAlignment = UITextAlignmentLeft ;
pendingListNumberLabel.textColor = [UIColor orangeColor];
pendingListNumberLabel.frame = CGRectMake(240, 6, 110, 30);
[pendingListNumberLabel setBackgroundColor:[UIColor clearColor]];
[cell addSubview:pendingListNumberLabel];
}
cell.textLabel.text = [affiliationsArray objectAtIndex:indexPath.row];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
return cell;
후 ... 당신 .... 위의 코드로! – borrrden
더 자세한 설명과 일부 코드 wud는 우리가 U를 돕는 데 도움이됩니다. :) –
코드를 보지 않고, 재사용 식별자를 부적절하게 사용하고 있다고 가정합니다. –