Add a possibility to disable/enable swipe actions of the cell#275
Add a possibility to disable/enable swipe actions of the cell#275ghost wants to merge 1 commit intoCEWendel:masterfrom kanstantsin-bucha:master
Conversation
|
is this related to #87 |
|
No, this is about reuse logic and life cycle of the UITableViewCell. Imagine that cell behaviour on the swipe is based on one boolean property. In the method - (BOOL)swipeableTableViewCell:(SWTableViewCell *)cell canSwipeToState:(SWCellState)state{ cell checks this property to determinate if it should do swipe. |
I have a business logic in the app where I should enable/disable swipe actions for one particular cell.
Initially I implement it by adding and removing buttons to the cell itself. But there was one issue with this solution. When user make pan gesture on the scroll view of the cell without buttons it changes content offset of a scrollview on every deceleration event and user see nothing. If table reload all cells in time when cell still have decelerating scroll view and still receiving deceleration events and such cell received some new buttons then correction logic implemented in deceleration event delegate method not work any more. Scroll view changes it's offset on next deceleration event and user see "randomly" cell that swiping by itself.
I think that it could always good to have a switch to enable/disable swipe actions without a side effects.