Skip to content

Commit

Permalink
Fix swipe issue after reloading a table. Fix issue MortimerGoro#163 S…
Browse files Browse the repository at this point in the history
…wipe not working after deleting a cell
  • Loading branch information
MortimerGoro committed Mar 20, 2016
1 parent 855052b commit 635d24a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions MGSwipeTableCell/MGSwipeTableCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ -(id) initWithFrame:(CGRect)frame

-(UIView *) hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
if (!_currentCell) {
[self removeFromSuperview];
return nil;
}
CGPoint p = [self convertPoint:point toView:_currentCell];
if (_currentCell && CGRectContainsPoint(_currentCell.bounds, p)) {
if (_currentCell && (_currentCell.hidden || CGRectContainsPoint(_currentCell.bounds, p))) {
return nil;
}
BOOL hide = YES;
Expand Down Expand Up @@ -725,6 +729,9 @@ - (void) showSwipeOverlayIfNeeded
if (!_allowsMultipleSwipe) {
//input overlay on the whole table
UITableView * table = [self parentTable];
if (_tableInputOverlay) {
[_tableInputOverlay removeFromSuperview];
}
_tableInputOverlay = [[MGSwipeTableInputOverlay alloc] initWithFrame:table.bounds];
_tableInputOverlay.currentCell = self;
[table addSubview:_tableInputOverlay];
Expand Down Expand Up @@ -843,7 +850,7 @@ -(void) setEditing:(BOOL)editing

-(UIView *) hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
if (_swipeOverlay && !_swipeOverlay.hidden) {
if (!self.hidden && _swipeOverlay && !_swipeOverlay.hidden) {
//override hitTest to give swipe buttons a higher priority (diclosure buttons can steal input)
UIView * targets[] = {_leftView, _rightView};
for (int i = 0; i< 2; ++i) {
Expand Down

0 comments on commit 635d24a

Please sign in to comment.