Make the UICollectionView scrollable even when its

2020-04-07 03:48发布

问题:

The UICollectionView disables scrolling by default when there is not enough cells in the view. When this occurs I need it to bounce back to position when pulled. Im am aware of a hack where I can fill the UICollectionView with empty tables to enable scrolling but I was hoping there would be a slightly more fluid example as

I don't want the view to scroll but instead to automatically bounce back to its position. This is because of the effect I have implemented below as can see below.

https://youtu.be/r75xB9-Mb4g

Is there a way to achieve this simply, when there is not enough cells in the UICollectionView the scroll is disabled.

回答1:

Try this :

self.collectionView.alwaysBounceVertical = YES;