Pretty simple issue. In cellForRowAtIndexPath I need to add a custom UILabel. So I try this in the given method:
UILabel *titleLbl = [[UILabel alloc] init];
//Other properties etc
if (indexPath.row == 0) titleLbl.text = @"1";
else if (indexPath.row == 1) titleLbl.text = @"2";
[cell addSubview:titleLbl];
Issue is that when scrolling down my table, the label starts repeating and duplicating.
How can I get around this?
Thanks.
Add that label as a subview in the
This way it will only be added when the cell is being allocated. To retrieve that label give it a tag and use viewWithTag method of your cell