gloubibou / HHPanningTableViewCell

Swipe to reveal implementation for iOS
249 stars 55 forks source link

Drawer View being shown at random on refresh/delete #35

Open georgemp opened 10 years ago

georgemp commented 10 years ago

Hi, I've been trying to track down the issue on this for a while, but, have been pretty unsuccessful. In my app, the drawer view shows up at random on refreshing/deleting cells from the tableview. I have modified the bundled demo app on a fork to demonstrate the problem. https://github.com/georgemp/HHPanningTableViewCell/tree/drawerIssues This demo app in this case allows refresh. But, if you refresh (might have to do it a few times), sometimes the new cell is displayed with the drawerView show. I would appreciate any ideas on how to prevent this. Thanks

georgemp commented 10 years ago

Since, it takes a while to reproduce, I've created a small video demonstrating the issue http://youtu.be/EIsc71BgPpA

Thanks

gloubibou commented 10 years ago

Hi!

It appears the problem is in the gesture recognizer.

On occasion, a pan is accidentally initiated when you try to pull to refresh. gestureRecognizerDidPan: installs the subviews on gesture begin and does not remove these on cancel.

I am not quite sure why of if this behavior is needed.

One way to fix the problem would be to make sure the scroll view's gesture recognizer has priority over our pan gesture recognizer.

Another way would be to modify gestureRecognizerDidPan: like this:

if (state == UIGestureRecognizerStateBegan) {
…
}
else if (state == UIGestureRecognizerStateEnded) {
…
}
else if (state == UIGestureRecognizerStateCancelled) {
    [self.drawerView removeFromSuperview];
    [self.shadowView removeFromSuperview];

    self.panningInProgress  = NO;
}

Please send in a pull request if you fix this problem.

Pierre

On 11 Apr 2014, at 12:50, georgemp notifications@github.com wrote:

Since, it takes a while to reproduce, I've created a small video demonstrating the issue http://youtu.be/EIsc71BgPpA

Thanks

— Reply to this email directly or view it on GitHub.

lukaszmargielewski commented 10 years ago

I have the same issue. For me it is VERY regular: Whenever I reload table with different cells than HHPanningTableViewCell and one of HHPanningTableViewCell's drawer view was reveal - it will stay in the table view:

  1. BEFORE RELOAD (with 1 drawer revealed): img_1200
  2. AFTER RELOAD (with new cell types - not HHPanningTableViewCells): img_1199
gloubibou commented 10 years ago

The problem reported by georgemp originated from the fact that the swipe gesture recognizer could be accidentally triggered by a pull-to-refresh gesture.

I believed this had been fixed by pull request #36. Please try that version.

Please also try the prior version and apply the fix described in my (oddly formatted) comment from Apr 11.

If neither fixes the issue, you are looking at different problem. Please verify that translation values are reset when cells get reused.