How to get touch outside current cell in iOS ?(swi

2019-09-12 17:57发布

问题:

I am creating a custom SwipeableCell to left/right. I want to detect touch outside of current cell to return it to default state. How can I do that?

Picture of my program

I know how to return cell to default state, but I don't know how to detect touch.

回答1:

Lets save the current NSIndexPath on the viewController, when you swipe on it to some variable.

In didSelectCellForRow, if the saved indexPath is not equal with the indexPath coming in, than lets restore the state of cell at the saved indexPath.