DraggableCollectionView icon indicating copy to clipboard operation
DraggableCollectionView copied to clipboard

Cells reordering does not work in iOs 10

Open alessandropetrolati opened this issue 8 years ago • 18 comments

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.

alessandropetrolati avatar Jul 14 '16 18:07 alessandropetrolati

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

alessandropetrolati avatar Jul 14 '16 20:07 alessandropetrolati

I believe iOS 10 UICollectionView already supports this

liuxuan30 avatar Jul 15 '16 00:07 liuxuan30

Long press gesture is not working here too after upgrade to iOS 10.

Altaibaatar avatar Sep 02 '16 01:09 Altaibaatar

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.

Altaibaatar avatar Sep 02 '16 01:09 Altaibaatar

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.

alessandropetrolati avatar Sep 02 '16 08:09 alessandropetrolati

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.

alessandropetrolati avatar Sep 02 '16 08:09 alessandropetrolati

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.

Altaibaatar avatar Sep 03 '16 02:09 Altaibaatar

iOS10 not press move, how to solve?

qiaobiao avatar Sep 06 '16 02:09 qiaobiao

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!

qiaobiao avatar Sep 06 '16 02:09 qiaobiao

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.

alessandropetrolati avatar Sep 06 '16 06:09 alessandropetrolati

Thank you very much@alessandropetrolati,It has been resolved。

qiaobiao avatar Sep 06 '16 06:09 qiaobiao

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?

jspavlick avatar Sep 14 '16 18:09 jspavlick

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.

sgoehler avatar Sep 20 '16 15:09 sgoehler

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; } }

sgoehler avatar Sep 20 '16 17:09 sgoehler

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.

alessandropetrolati avatar Sep 22 '16 19:09 alessandropetrolati

For those who are facing this issue, I've created a fork of DraggableCollectionView which includes @sgoehler fix and other iOS 9 fixes.

DraggableCollectionView

alauf-ap avatar Sep 28 '16 16:09 alauf-ap

@alauf-ap Works great! Thanks.

blaaat avatar Oct 26 '16 07:10 blaaat

@alauf-ap thank you!!! your fork should be merged in the master branch. And thanks for the fix @sgoehler!

rickrvo avatar Nov 27 '17 21:11 rickrvo