UICollectionView inside of UIScrollView

不羁的心 提交于 2020-01-10 05:11:06

问题


I have a

  • UIScrollView
    • Labels
    • Labels
    • UICollectionView

I have disabled the UICollectionViews scrolling functionality, so I only want to scroll with the Scrollview. My problem is that I don't know how I can calculate the UICollectionViews height so I can update my UIScorllView. If it's many elements inside the UICollectionView, it's get clipped.

I have created this little HTML example to show what I'm looking for http://jsfiddle.net/hDwPH/

Dummy code

回答1:


So my suggestion would be to use a single UIScrollview. Create your own view (we'll call it A) with whatever you are trying to repeat in the Collection view and addSubview A to the UIScrollview over and over for however many times you want.

Another way that just came to mind would be to use entirely a collectionview create two collectionviewcells, one that has your labels and you only display it for the first cell and the other collectionviewcell for all the others



来源:https://stackoverflow.com/questions/16224599/uicollectionview-inside-of-uiscrollview

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