I have a UICollectionView
set up with a UICollectionViewDataSource
that currently provides six items.
These are fewer than needed to fill the scree
With storyboards in attributes inspector for collection view "Bounces" and "Bounces Vertically" should be checked.
bounces
, despite it's name, isn't the right property to set. You also need to set alwaysBounceVertical
and / or alwaysBounceHorizontal
. From the documentation:
If this property is set to YES and bounces is YES, vertical dragging is allowed even if the content is smaller than the bounds of the scroll view. The default value is NO.
Note the confusing name in IB .. https://stackoverflow.com/a/18391029/294884
Setting the height of the UICollectionView
to size of UIView
will make your scrolling problem disabled. If the UICollectionView
is 568 pixels tall then it will only ever need to scroll if it has more than 568 pixels worth of content in it. You should set it to the height of the view it is contained in (same as the width).
Hope it helps you.