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

Selected cell hides selectedBackgroundView on dragging of neighbor cell #13

Open pronebird opened 11 years ago

pronebird commented 11 years ago

Hi,

If I don't miss anything in my implementation then I found a bug. If I select the first cell and then hold a finger on the second cell, the second cell gets selected for some time (e.g. shows my customized selectedBackgroundView), then longtap recognizer triggers and selection state gets cancelled, the first cell then loses selected state as well, but it's only a graphical defect, in fact If I start scrolling collection view the first cell repaints and becomes visually selected as before. I use simple horizontal flow layout inherited from DraggableCollectionViewFlowLayout.

lukescott commented 11 years ago

I'm not sure if I fully understand. Do you mean highlighted or selected states? Can you reproduce this in the FlowLayoutDemo? Do you need to modify the demo to reproduce? Can you give me step by step in the FlowLayoutDemo?

pronebird commented 11 years ago

I do not set a view for highlighted state, I only set selectedBackgroundView, so I see my custom selectedBackgroundView displayed when I hold a finger on cell before long tap recognizer triggers. I'll try to reproduce it in FlowLayoutDemo and give you more information on that.

pronebird commented 11 years ago

I managed to reproduce it, here is the change set to bring selectedBackgroundView to FlowLayout demo: https://github.com/pronebird/DraggableCollectionView/commit/c2ebd9a8b1f269d2540994677683f570e77fff30

Steps to reproduce:

  1. Select any cell
  2. Long tap on any neighbor cell. Previously selected cell visually lose the selection appearance, tapped view displays as selected before long tap recognizer triggers, then orange border around disappears.
  3. Unhold a tapped cell, you don't have to drag it. What we see now is that there's visually no selected cells.
  4. Scroll a bit to trigger repaint, you don't have to scroll much or bring previously selected cell off-screen, small change is enough to trigger repainting, now previously selected cell is visually selected again.