When using drag and drop with a UICollectionView embedded in a UIPageViewController, the delegate immediately triggers didExit
when paging.
- Begin Drag and Drop gesture
- Page to new view
- CollectionDropDelegate immediately fires:
newCV.didEnter
oldCV.didExit
newCV.didExit
newCV.didUpdate
is never called. If we let go of the drop at this point it cancels. My PageViewController is not fullscreen, so if I move the drag outside and back in I can still perform the drop after paging, but it's a bad user experience.
Notes:
- Not using UICollectionViewController
- CollectionView gets added to the UIViewController hierarchy in
viewDidLoad
Any ideas?
I was able to resolve this by toggling
collectionView.isUserInteractionEnabled
. Figuring out where in the lifecycle to do this was a bit challenging, and ultimately I ended up using the UIPageViewControllerDelegatedidFinishAnimating...
So in my
ContentViewController.viewDidLoad
, I setcollectionView.isUserInteractionEnabled = false
and then in the delegate, I need to conditionally enable/disable the collection views.