josshad / EHHorizontalSelectionView

Horizontal table view style controller
MIT License
344 stars 60 forks source link

Line View Cell Selection #1

Open JoshR604 opened 8 years ago

JoshR604 commented 8 years ago

When using the LineViewCell and you have a cell selected at beginning of the SelectionView and then scroll to the far cell that was off-screen and select the far cell and scroll back to the first cell both will appear to be selected.

This is due to the fact that the cells are reusable and when a cell is selected, and scrolled off-screen, in the 'didSelectItemAtIndexPath' the collection view is unable to find the cell at the '_selectedIndex' since it is now offscreen and dequeued when using '[collectionView cellAtIndex..]'

A quick solution I came up with was to add a '_selectedCell' variable of type EEHorizontalViewCell in the EHHorizontalSelectionView class which will always give us access to the currently selected cell.

I can do a pull request for my code if you'd like.

PS. Thanks for sharing your selectionview :)

josshad commented 8 years ago

Ok. Pull it.:)