Yes, you are right because of the reuse of your cells through dequeueReusableCell with an identifier like -
dictionaryTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
according to your requirements, you will set the star image in the cell to indicate some selected elements in the corresponding cell, for example
BOOL isTheObjectThere = [self.favoriteArry containsObject:self.tableData[indexPath.row]]; if (isTheObjectThere==TRUE) { cell.favImg.image=[UIImage imageNamed:@" 3081@3x.png "]; }
If any cell with a star-shaped image is reused, it should be deleted, if the next cell does not have some favorite elements, but if it has some favorite elements, then it should be used as
To solve this problem, just add the else case with the above if statement as
if (isTheObjectThere == TRUE) cell.favImg.image=[UIImage imageNamed:@" 3081@3x.png "]; else cell.favImg.image=nil;
source share