Reputation: 1921
Here is my code for creating a cell
cell.textLabel.text=[listdata objectAtIndex:indexPath.row ];
if(indexPath.row==1)
cell.detailTextLabel.text=@"Some text";
return cell;
Here are total 20 rows and only 8 rows are visible at a time
My problem is that detail text label it repeated at many rows when i do scrolling....
please help
Upvotes: 1
Views: 112
Reputation: 3401
Try this:
cell.textLabel.text = [listdata objectAtIndex:indexPath.row];
if (indexPath.row == 1)
cell.detailTextLabel.text = @"Some text";
else
cell.detailTextLabel.text = @"";
return cell;
Table cells are recycled, so you have to reset everything every time.
Upvotes: 4