Search code examples
iosxcodescrollbaruicollectionview

How To Show Scrollbar Always On UICollectionView


I have a UICollectionView added to a UIView in an app I am working on. Displayed in the UICollectionView I have a set of images pulled from Core Data. The vertical scrolling works fine but the scrollbar does not display until the user touches the UICollectionView.

How can I make sure the scrollbar at the right is always visible so that an indication is given to the user that it is scrollable?


Solution

  • You can't make them always visible. Instead, you can flash them once, when the user is first presented with the collection view to notify them, that this view can be scrolled.

    Since UICollectionView is a subclass of UIScrollView you can do this:

    [myCollectionView flashScrollIndicators];
    

    Check out the Settings app for instance. When you go to a settings list that is longer then the screen, the scroll indicator is flashed once.