DraggableCollectionView
DraggableCollectionView copied to clipboard
Cells reordering does not work in iOs 10
Hello everybody, I've discovered an issue in xCode 8.0 beta 2 (iOs 10 sdks). I can't drag the cells anymore, it think is something related to _panPressGestureRecognizer in LSCollectionViewHelper.m. Someone could help to fix it? Thanks.
A workaround is to comment:
`- (id)initWithCollectionView:(UICollectionView *)collectionView { ...
// for (UIGestureRecognizer *gestureRecognizer in _collectionView.gestureRecognizers) { // if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) { // [gestureRecognizer requireGestureRecognizerToFail:_longPressGestureRecognizer]; // break; // } // }
... }`
in the LSCollectionViewHelper.m
I believe iOS 10 UICollectionView already supports this
Long press gesture is not working here too after upgrade to iOS 10.
Hello, @alessandropetrolati I have a same issue after upgrade to iOS 10. Did you fix it? Can commenting those lines solve the problem? Thank you.
Hello, do you mean iOs 10 beta?
The current version of Moebius (on the store) is affected by this problem on iOs 10 but I’ve fixed and there is a new version waiting for release. Have you the last beta? Could you send me your Apple mail ID, so i can include you as beta tester. Thanks for support and est regards ape
Alessandro Petrolati Loc. Acquaviva, 33 61043 Cagli/PU Italy
www.apesoft.it http://www.apesoft.it/ [email protected]
[email protected] mailto:[email protected]
On 02 Sep 2016, at 03:40, Agula [email protected] wrote:
Hello, @alessandropetrolati https://github.com/alessandropetrolati I have a same issue after upgrade to iOS 10. Did you fix it? Can commenting those lines solve the problem? Thank you.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lukescott/DraggableCollectionView/issues/61#issuecomment-244261375, or mute the thread https://github.com/notifications/unsubscribe-auth/ADAzSPMRjrH4ACscFunKMxN6qG_rXSXLks5ql36EgaJpZM4JMu52.
I’ve solved (temporarily) by comment this code in the LSCollectionViewHelper.m
-
(id)initWithCollectionView:(UICollectionView *)collectionView { self = [super init]; if (self) { _collectionView = collectionView; [_collectionView addObserver:self forKeyPath:@"collectionViewLayout" options:0 context:&kObservingCollectionViewLayoutContext]; _scrollingEdgeInsets = UIEdgeInsetsMake(50.0f, 50.0f, 50.0f, 50.0f); _scrollingSpeed = 300.f;
_longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGesture:)]; [_collectionView addGestureRecognizer:_longPressGestureRecognizer]; _panPressGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)]; _panPressGestureRecognizer.delegate = self; [_collectionView addGestureRecognizer:_panPressGestureRecognizer];
#warning iOs 10 bug, add code or comment statment commented! // for (UIGestureRecognizer _gestureRecognizer in collectionView.gestureRecognizers) { // / // if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) { // [gestureRecognizer requireGestureRecognizerToFail:_panPressGestureRecognizer]; // break; // } // */ // if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) { // [gestureRecognizer requireGestureRecognizerToFail:_longPressGestureRecognizer]; // break; // } // }
[self layoutChanged];
}
return self;
}
Cheers.
Alessandro Petrolati Loc. Acquaviva, 33 61043 Cagli/PU Italy
www.apesoft.it http://www.apesoft.it/ [email protected]
[email protected] mailto:[email protected]
On 02 Sep 2016, at 03:40, Agula [email protected] wrote:
Hello, @alessandropetrolati https://github.com/alessandropetrolati I have a same issue after upgrade to iOS 10. Did you fix it? Can commenting those lines solve the problem? Thank you.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lukescott/DraggableCollectionView/issues/61#issuecomment-244261375, or mute the thread https://github.com/notifications/unsubscribe-auth/ADAzSPMRjrH4ACscFunKMxN6qG_rXSXLks5ql36EgaJpZM4JMu52.
Thank you for your reply. I did mean public beta. But yesterday I returned to the iOS 9 due to so many bugs of the iOS 10 beta. By the way, I couldn't find the app named Moebius. (from Japanese app store)
Thanks.
iOS10 not press move, how to solve?
Hello, @alessandropetrolati
I also encountered a long press gesture can not move cell problems. I read your solution, you are proven no problem, right? Thank you!
Hello, this wokaround solved the problem for me Cheers
Inviato dall'iPhone di ape~
Il giorno 06 set 2016, alle ore 04:58, qiaobiao [email protected] ha scritto:
Hello, @alessandropetrolati
I also encountered a long press gesture can not move cell problems. I read your solution, you are proven no problem, right? Thank you!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Thank you very much@alessandropetrolati,It has been resolved。
Testing in the simulator, it is safe to comment out this code for iOS 8, 9, and 10. Which, I was quite surprised at. Why was this code even included in the first place?
I think I know why it was there in the first place - the "fix" by commenting out renders nested draggable collection views unusable or at least unreliable. The code was there to handle a collectionview within a collectionview - only if the containing collection view fails to drag, the contained collection view will be asked.
Okay, my guess was wrong. It's not about nested collectionViews, it's probably only about other long press recognizers in the collection view. The reason why the commented out code didn't work any longer was probably because the long press gesture recognizer required itself to fail. This may have been ignored in previous iOS versions, but is not any longer with iOS 10. My suggestion to correct the code while keeping its functionality would be to add a check for the own long press recognizer: for (UIGestureRecognizer *gestureRecognizer in _collectionView.gestureRecognizers) { if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]] && gestureRecognizer != _longPressGestureRecognizer) { [gestureRecognizer requireGestureRecognizerToFail:_longPressGestureRecognizer]; break; } }
Hello, its working for me and its a better solution, thanks.
Alessandro Petrolati Loc. Acquaviva, 33 61043 Cagli/PU Italy
www.apesoft.it http://www.apesoft.it/ [email protected]
[email protected] mailto:[email protected]
On 20 Sep 2016, at 19:11, sgoehler [email protected] wrote:
Okay, my guess was wrong. It's not about nested collectionViews, it's probably only about other long press recognizers in the collection view. The reason why the commented out code didn't work any longer was probably because the long press gesture recognizer required itself to fail. This may have been ignored in previous iOS versions, but is not any longer with iOS 10. My suggestion to correct the code while keeping its functionality would be to add a check for the own long press recognizer: for (UIGestureRecognizer *gestureRecognizer in _collectionView.gestureRecognizers) { if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]] && gestureRecognizer != _longPressGestureRecognizer) { [gestureRecognizer requireGestureRecognizerToFail:_longPressGestureRecognizer]; break; } }
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lukescott/DraggableCollectionView/issues/61#issuecomment-248367484, or mute the thread https://github.com/notifications/unsubscribe-auth/ADAzSAP5ZjADB4q0j1CyHhxoNlEv36rPks5qsBPcgaJpZM4JMu52.
For those who are facing this issue, I've created a fork of DraggableCollectionView which includes @sgoehler fix and other iOS 9 fixes.
@alauf-ap Works great! Thanks.
@alauf-ap thank you!!! your fork should be merged in the master branch. And thanks for the fix @sgoehler!