문제

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)

enter image description here

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top