How do you make a UICollectionView scrollable when you only have a few cells?
I've implemented a UICollectionView that lays out cells in the form of a grid. If there's only a few cells, then by default, UICollectionView is not scrollable (all the cells fit in the screen of the phone).
However, I've also implemented a PullToRefreshView. This works perfectly when I have a lot of cells, as the UICollectionView is then scrollable and I can pull and refresh.
What can I do to make the UICollectionView scrollable despite only having a few cells?
Here is how I initialize my PullToRefreshView
self.pull = [[PullToRefreshView alloc] initWithScrollView:self.collectionView];
[self.collectionView addSubview:self.pull];
Because UICollectionView inherits from UIScrollView, it's as simple as setting self.collectionView.alwaysBounceVertical = YES
to get persistent bouncing, no matter how many cells your collection view has.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With