I would like all cells in my UITableView to always show delete accessories and disclosure indicators:
(the reason for this is that I don't have/don't want an edit button)
This works in 5.1 with this code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//the usual code
[self.tableView setEditing:YES animated:YES];
cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
This is not producing the same behavior in iOS 6.0. When I add a row, it appears without a delete accessory. Interestingly, if I then select the cell (which runs didSelectRowAtIndexPath), I can press cancel in my Details View and only THEN does the delete accessory appear in my table cell.
Can anyone explain this discrepancy? I can't find anything about this in Apple's documentation (if you could point me to something, I would be grateful). Maybe I shouldn't be putting the code in this method in the first place? Thanks.
Your issue is being caused by calling setEditing:animated:
on the table view in your cellForRowAtIndexPath:
. You should only call that once in viewDidLoad
.