Skip to content

Commit

Permalink
Add click animation completion code after a cell is deleted (well, re…
Browse files Browse the repository at this point in the history
…ally hidden after a delete row animation without being deallocated to be reused later). Fix issue MortimerGoro#91 supposed to be caused by a null cell.indexPath because the callback was called while/after a cell is deleted
  • Loading branch information
MortimerGoro committed Mar 20, 2016
1 parent 9ac9abc commit 6772926
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion MGSwipeTableCell/MGSwipeTableCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,10 @@ -(void) panHandler: (UIPanGestureRecognizer *)gesture
backgroundColor = expansion.backgroundColorCopy; //keep expansion background color
expansion.backgroundColorCopy = expSettings.expansionColor;
}
[self setSwipeOffset:_targetOffset animation:expSettings.triggerAnimation completion:^{
[self setSwipeOffset:_targetOffset animation:expSettings.triggerAnimation completion:^(BOOL finished){
if (!finished || self.hidden) {
return; //cell might be hidden after a delete row animation without being deallocated (to be reused later)
}
BOOL autoHide = [expansion handleClick:expandedButton fromExpansion:YES];
if (autoHide) {
[expansion endExpansionAnimated:NO];
Expand Down

0 comments on commit 6772926

Please sign in to comment.