How to reach the current selected cell in didSelectRowAtIndexPath?

前端 未结 6 1759
迷失自我
迷失自我 2021-02-01 00:10

I want to change the accessory view type of a cell through the method: didSelectRowAtIndexPath , i.e. when a row is selected I want to change the accessory view type, can I do t

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-01 00:49

    Use the below function and pass the index path of the selected row so that the particular cell is reloaded again.

    - (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
    

    Another solution: store the selected row index and do a reload of tableview. Then in cellForRowAtIndexPath check for the selected row and change the accessory view of the cell.

提交回复
热议问题