UITableView tap to deselect cell

前端 未结 14 1639
野性不改
野性不改 2020-12-16 10:37

I have a UITableViewCell that is selected when tapped. During this selected state, if the user taps the cell again, I want the cell to deselect.

I can\

14条回答
  •  时光说笑
    2020-12-16 11:14

    I was after the same thing but @occulus' answer provided me the hint I was missing.

    It made me realize the way to get this done is to allow multiple selection in the table view and manually deselect previously selected rows when a new row is selected using one of the delegate methods.

    It seems quite natural that in single selection mode, the table view tries to leave one row selected as much as possible, thus not deselecting on tapping a selected row.

提交回复
热议问题