类似 iOS 主屏幕的 UICollectionView [英] UICollectionView like iOS Home Screen
问题描述
我想制作一个类似于 iOS 主屏幕的 UICollectionView.我发现了几个(很好的)样本,例如:
I wanna make an UICollectionView like iOS Home Screen. I found several (and good) samples like:
http://mobile.tutsplus.com/tutorials/iphone/uicollectionview-布局/
http://www.cocoacontrols.com/platforms/ios/controls/sespringboard
http://www.cocoacontrols.com/platforms/ios/controls/aqgridview
http://www.cocoacontrols.com/platforms/ios/controls/namenu
http://www.cocoacontrols.com/platforms/ios/controls/mgbox2
以上所有库都运行良好.编辑、删除和动画不是问题.但是将两个单元组合成一个新组,好吧,没有一个库能够做到这一点.我进行了大量搜索,但没有找到任何东西.有人知道任何库可以将两个单元格与拖放结合起来吗?!?!或者至少有一些制作技巧?!?
All libraries above work well. Editing, removing and animating is not a problem. But combining two cells into a new group, well, none of the libraries was able to do it. I heavily searched and I didn't find anything. Does anybody know any libraries to combine two cells with drag and drop?!?! Or at least has some tips on how to make?!?
推荐答案
您可以使用 section 来对项目进行分组,并使用 SupplementaryElements 来装饰组.
You can use sections to group items and SupplementaryElements to decorate groups.
或者
你也可以只创建2种不同的UICollectionViewCells:一个普通单元格+一个分组单元格.
You can also just create 2 kinds of different UICollectionViewCells: one normal cell + one group cell.
如果您的数据源反映了分组,它应该直接决定在 collectionView:cellForItemAtIndexPath: 中返回哪一个.
If your data source reflects grouping it should straight-forward to decide which one to return in collectionView:cellForItemAtIndexPath: .
这篇关于类似 iOS 主屏幕的 UICollectionView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!