Search code examples
iphoneobjective-cwarningsaccessory

iphone objective-c interesting problem with accessory and setEditing


In my DetailViewController i have the code

UPDATED x2

This is my setEditing

- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
    [super setEditing:editing animated:animated];
    [tableView setEditing:editing animated:YES];  //this line was added to force editing Mode
....

In my detailViewController I want to send tableView the 'magic/whatever it is' to register 'editing mode' to change the accessory, but I dont want to bring up the delete buttons. Previously I didnt have the line [tableView setEditing:editing animated:YES];, and so I only want it to bring up the accessory.


Solution

  • You should definitely fix this.

    When you create the table view cell (in tableView:cellForRowAtIndexPath:), set the accessoryType property to UITableViewCellAccessoryNone and the editingAccessoryType property to UITableViewCellAccessoryDisclosureIndicator.

    You do this instead of implementing the deprecated tableView:accessoryTypeForRowWithIndexPath: method.