You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.
Thanks for implementing the LongPressGesture recogniser some time ago.
I've been using it in the app I'm developing. I have a list of items arranged in a line. Scrolling along the view works really well. However I have found that when wanting to drag it's not robust enough.
Synopsis
User pans around on the CollectionView.
Some of the taps are registered as a long-press, because of the low duration.
Drag begins; drag view is created on some window layer.
Collection view continues with fixed inertia; stops panning; hijacks touch
Drag is NEVER COMPLETED; drag view stays on screen. Looks like a bug.
Reproduction
This occurs only sometimes, but often enough for the user to notice. The easiest way to bump up the minimmumPressDuration to something really low like 0.05f. A low duration is very important to ensure that the whole operation feels natural for the user.
After some investigation it seems that the UIScrollView's panGestureRecognizer somehow hijacks those touches, as you suspected.
The drag recognizer only receives a -touchesBegan: event, then the reporting stops (which is why the drag is never completed). Unfortunately, I don't see how the library could prevent this.
However there is a workaround: require the UIScrollView.panGestureRecognizer to wait until the drag recognizer failed like this:
UIScrollView *scrollView = …; // Or a sublass like UITableView or UICollectionView for that matter
UIGestureRecognizer *dragRecognizer = …;
[scrollView.panGestureRecognizer requireGestureRecognizerToFail:dragRecognizer];
I updated the example code to include this workaround.
Thanks for implementing the LongPressGesture recogniser some time ago.
I've been using it in the app I'm developing. I have a list of items arranged in a line. Scrolling along the view works really well. However I have found that when wanting to drag it's not robust enough.
Synopsis
User pans around on the CollectionView.
Some of the taps are registered as a long-press, because of the low duration.
Drag begins; drag view is created on some window layer.
Collection view continues with fixed inertia; stops panning; hijacks touch
Drag is NEVER COMPLETED; drag view stays on screen. Looks like a bug.
Reproduction
This occurs only sometimes, but often enough for the user to notice. The easiest way to bump up the minimmumPressDuration to something really low like 0.05f. A low duration is very important to ensure that the whole operation feels natural for the user.
I'll try to prepare a demo project to illustrate this problem.
The text was updated successfully, but these errors were encountered: