Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 951
motionpotion Avatar asked May 14 '13 19:05

motionpotion


2 Answers

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.

like image 149
DrummerB Avatar answered Nov 02 '22 01:11

DrummerB


FYI for Swift:

myCollectionView.flashScrollIndicators()
like image 38
Azin Mehrnoosh Avatar answered Nov 02 '22 02:11

Azin Mehrnoosh