lukescott / DraggableCollectionView

Extension for the UICollectionView and UICollectionViewLayout that allows a user to move items with drag and drop. --- HELP WANTED --- Looking for maintainer and help with the experimental branch.
MIT License
549 stars 175 forks source link

Cells reordering does not work in iOs 10 #61

Open alessandropetrolati opened 8 years ago

alessandropetrolati commented 8 years ago

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 commented 8 years ago

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

liuxuan30 commented 8 years ago

I believe iOS 10 UICollectionView already supports this

Altaibaatar commented 8 years ago

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

Altaibaatar commented 8 years ago

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.

alessandropetrolati commented 8 years ago

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/ info@apesoft.it

apps@apesoft.it mailto:info@alessandro-petrolati.it

On 02 Sep 2016, at 03:40, Agula notifications@github.com 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 commented 8 years ago

I’ve solved (temporarily) by comment this code in the LSCollectionViewHelper.m

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/ info@apesoft.it

apps@apesoft.it mailto:info@alessandro-petrolati.it

On 02 Sep 2016, at 03:40, Agula notifications@github.com 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.

Altaibaatar commented 8 years ago

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.

qiaobiao commented 8 years ago

iOS10 not press move, how to solve?

qiaobiao commented 8 years ago

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!

alessandropetrolati commented 8 years ago

Hello, this wokaround solved the problem for me Cheers

Inviato dall'iPhone di ape~

Il giorno 06 set 2016, alle ore 04:58, qiaobiao notifications@github.com 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.

qiaobiao commented 8 years ago

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

jspavlick commented 8 years ago

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?

sgoehler commented 7 years ago

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 commented 7 years ago

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

alessandropetrolati commented 7 years ago

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/ info@apesoft.it

apps@apesoft.it mailto:info@alessandro-petrolati.it

On 20 Sep 2016, at 19:11, sgoehler notifications@github.com 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.

alauf-ap commented 7 years ago

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

DraggableCollectionView

blaaat commented 7 years ago

@alauf-ap Works great! Thanks.

rickrvo commented 6 years ago

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