Skip to content

Commit

Permalink
Fixed duplicated expansion backgrounds race conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Nov 16, 2014
1 parent eaa3f10 commit 9d78338
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions MGSwipeTableCell/MGSwipeTableCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ -(void) endExpansioAnimated:(BOOL) animated
{
if (_expandedButton) {
_expandedButtonAnimated = _expandedButton;
if (_expansionBackgroundAnimated && _expansionBackgroundAnimated != _expansionBackground) {
[_expansionBackgroundAnimated removeFromSuperview];
}
_expansionBackgroundAnimated = _expansionBackground;
_expansionBackground = nil;
_expandedButton = nil;
Expand All @@ -195,6 +198,10 @@ -(void) endExpansioAnimated:(BOOL) animated
[_expansionBackgroundAnimated removeFromSuperview];
}];
}
else if (_expansionBackground) {
[_expansionBackground removeFromSuperview];
_expansionBackground = nil;
}
}

-(UIView*) getExpandedButton
Expand Down Expand Up @@ -737,6 +744,10 @@ - (void)setSwipeOffset:(CGFloat) newOffset;

MGSwipeButtonsView * activeButtons = sign < 0 ? _rightView : _leftView;
if (!activeButtons || offset == 0) {
if (_leftView)
[_leftView endExpansioAnimated:NO];
if (_rightView)
[_rightView endExpansioAnimated:NO];
[self hideSwipeOverlayIfNeeded];
_targetOffset = 0;
[self updateState:MGSwipeStateNone];
Expand Down

0 comments on commit 9d78338

Please sign in to comment.