How To Show Scrollbar Always On UICollectionView

喜夏-厌秋 提交于 2019-12-22 04:43:22

问题


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?


回答1:


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.




回答2:


FYI for Swift:

myCollectionView.flashScrollIndicators()


来源:https://stackoverflow.com/questions/16551122/how-to-show-scrollbar-always-on-uicollectionview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!