Ramotion/expanding-collection

didSelectItemAt not working

Opened this issue · 2 comments

I have followed guidance of this library, and have faced second problem.
The first one is for connecting frontViewContainer, backViewContainer, frontConstraintY, backConstraintY, and I had no solution for that #34 #26 .
But I was able to figure it out with copy/pasting the demo cell from demo project.

Now the second problem is, I have defined didSelectItemAt method, but it's not calling all the time.

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        guard let cell = collectionView.cellForItem(at: indexPath) as? MyCollectionViewCell, currentIndex == indexPath.row else { return }

        cell.cellIsOpen(!cell.isOpened)
}

The viewcontroller is inherited from ExpandingViewController, and MyCollectionViewCell is inherited from BasePageCollectionCell.
I'm not sure why does this happening.

Any help would be appreciated.
Thanks

I'm facing the same problem. Would someone help us?
Thanks :)

I found the solution :]

Inside didSelectItemAt, set:

 if cell.isOpened == false {
            cell.cellIsOpen(true, animated: true)
        } else {
            pushToViewController(YourTableViewController())
        }

Make sure to set 'animated' to true when setting the cellsOpen property. I know the Demo Documentation just puts 'cell.cellIsOpen(true)' but you need it like this : cell.cellIsOpen(true, animated: true)

Hope that Helps!!