Unable to Scroll UICollectionView Cell

Hi,


I have utilised UICollectionView for my app. I have programatically defined cell uptom 20.


When I try to scroll while tapping on cell it doesn't scroll in simulator.


But when I click in gap between cells & try to scroll then I am able to scroll.


Why is that so? What I am doing wrong? I really don't know.


I have already serached on the web for possible answers but no avail. I have already done with solutions from the web like making interaction enable, making scroll enable, making bounce enable. But it is not solving my problem.

Accepted Reply

It seems more likely there’s some view in your cells which is swallowing all the touches. Does it do the same with empty cells, or with a view over top of your cell’s content with userInteractionEnabled set to false?

Replies

Can you show the complete code of the controller ?


Have you set the delegates for the collectionView ?

I noticed one behaviour that when scroll bar appears when I click on gap inbetween cell empty space I am able to scroll till the end even on clicking on cells.


Once scroll bar gets hidden then I am not able to scroll.


I am already using following settings in viewdidload & also in IB

self.collectionView?.showsVerticalScrollIndicator = true


Is my Xcode project is corrupt?

It seems more likely there’s some view in your cells which is swallowing all the touches. Does it do the same with empty cells, or with a view over top of your cell’s content with userInteractionEnabled set to false?

please, show the code of you controller where the collectionView is.

You are quite right... Cell had UIButton that was blocking the touches.


After removing button from IB, App's UICollectionViewCell scroll started working.