Swipe to delete?

Discussion in 'iOS Programming' started by caldwelljason, Sep 25, 2008.

  1. caldwelljason macrumors member

    Jul 9, 2008
    OK. Bonehead question of the day:

    I have added a UITableView to a view. I would like to have the "swipe to delete" behavior. Everything I read from Apple indicates it's "just there" on a UITableView. But no so much for me... :(

    I am handling the editingStyleForRowAtIndexPath method and returning UITableViewCellEditingStyleDelete, but that never gets called. My other delegate methods do. I copied the signature directly from the documentation, so I believe it to be correct.

    I also implemented the willBeginEditingRowAtIndexPath and didEndEditingRowAtIndexPath methods, which are (obviously) also not called.

    I can set the whole table to edit mode and it works fine. But then I have the delete icons all the time. Don't want it. I also don't necessarily want to go with a button to enter and leave "Edit" mode, if I can avoid it.

    Any help? Is there something I have to do to the list to get it to respond to the swipe?
  2. caldwelljason thread starter macrumors member

    Jul 9, 2008
    Bonehead answer

    You have to implement commitEditingStyle to get that behavior.

    I wish that was documented somewhere. :rolleyes:

    I decided to just move on and get the data implementation working. As soon as I added that method, my swipe action worked...:eek:

    Anyway, there it is, documented so that I will find it next time I search for it...:p
  3. elronaldo macrumors newbie

    Sep 22, 2008
    When using this Swipe to Delete mode is it possible to detect this specific edit mode? For example when you are in swipe-delete view the left side of the cell does not need to be adjusted, as the delete circle is not shown.

    Any ideas?
  4. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Come on guys, all this stuff is documented in the Table View programming guide:

    You can do a full-text search of the documentation by the following method:

    Enter the text you want to search for, say 'swipe' in the search box at the top of the documentation window. Select 'Apple iPhone OS 2.1' in the Doc Sets Pane. Choose 'Full-Text' in the selection bar at the top left. Then search.

Share This Page