I've been working with a great bit of code LXReorderableCollectionViewFlowLayout (written by Stan Chang Khin Boon). It allows for moving items around in a UICollectionView
I have a collection view with multiple sections. The sections are using a header with several controls in them. I allow the user to create empty sections and drag items into these sections
I using the collection view to show multiple albums of photos. Each section correlates to a different album. Dragging a photo from "Album 1" to "Album 2" works fine when each album already has items in it.
But, if the album (section) is empty, I can't move objects into that empty section.
I think the problem is with "indexPathForItemAtPoint". This method provides the correct NSIndexPath if the section has items in it. But if it's empty, it always returns section = 0, row = 0.
When I cross the border from section "0" into section "1" the NSIndexPath theIndexPathOfSelectedItem goes to 0,0 (section, row). I would have expected it to go to 1,0.
The problem seems to be with "indexPathForItemAtPoint". It isn't taking into consideration that the section might be empty and just defaults to 0, 0 when I cross the border into a different (and empty) section.
Like I said earlier, if there are items already in section "1" then the indexPath is set correctly.
Any ideas on what I'm doing wrong?