swipe to delete when already in edit mode

后端 未结 2 1575
滥情空心
滥情空心 2021-02-08 10:19

I have an iphone app using a uitableview where I\'d like the \"reorder\" controls to always be displayed, and have the user swipe to delete rows.

The approach I\'m curre

相关标签:
2条回答
  • 2021-02-08 10:55

    When the user swipes on a given row, you need to store a reference somewhere so that you can change the value returned by editingStyleForRowAtIndexPath and shouldIndentWhileEditingRowAtIndexPath. Your best bet is likely to use indexPathForCell on the cell that is swiped and store that. Then in the two display methods above you need to check if the NSIndexPath is the same or not (I'm not sure if they will be the same pointer or if you'll need to compare the section/row values - testing required). If they match, display the delete button.

    Note that you may need to call reloadData on your tableView to have the effect appear without scrolling away and back again.

    0 讨论(0)
  • 2021-02-08 11:14

    I'm wondering if the way you're headed now would break the Human Interface guidelines, which would result in the app not getting approved.

    I can't see why you can't capture the swipe gesture and then use that to 'unhide' the red delete (stop sign) icons for the delete confirmation?

    0 讨论(0)
提交回复
热议问题