LXReorderableCollectionViewFlowLayout
LXReorderableCollectionViewFlowLayout copied to clipboard
EXC_BAD_ACCESS when layout is changed on collection view
Steps to simulate:
- Set collection view the
LXReoderableCollectionViewFlowLayout
- After the collection view is visible on screen change the layout using
[UICollectionView setCollectionViewLayout:<new layout instance
. (Any layout class will work.) - Perform any gesture on the collection view. (long press or swipe will work)
- EXC_BAD_ACCESS
The crash occurs because the gesture recognizers that have been setup on the collection view are never removed when the layout is removed from the collection view. So when a gesture occurs, the recognizer tries to call the delegate method gestureRecognizerShouldBegin:
on the layout which has by now been deallocated.
@rakeshta Wow... this helped me out a LOT! Thank you!
do you can hand a pull request to fix this?