I’ve been modifying a screen in my app and added a disclosure button and another screen when the button is tapped to allow editing of the text in the row.
However, I want one of the rows never to have a disclosure button.
The problem is the table is sorted alphabetically and when the text is changed (from an update in the edit screen) the position of the row can change and in some circumstances I get a disclosure button on the row where i don’t want it.
I have
[self rebuildItems];
[table reloadData];
in viewWillAppear
And
if (![cell.textLabel.text isEqualToString:@"Uncategorized"]) {
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
in cellForRowAtIndexPath
Where am I going wrong ?
In your cellForRowAtIndexPath, you need to reset the cell.accessoryType every time. The reason being is that the normal code recycles the cells, and you could get a recycled cell that has the accessoryType from a different cell, and it’s not being triggered as being Uncategorized.