相关疑难解决方法(0)

如何在UICollectionView中将Supplementary View float作为Section Headers在UITableView普通样式中进行

我正在努力实现"浮动节头"效果UICollectionView.如果没有大量的努力工作,那么在UITableView(默认行为UITableViewStylePlain)中很容易做到的事情似乎是不可能的UICollectionView.我错过了明显的吗?

Apple没有提供有关如何实现此目标的文档.似乎必须子类化UICollectionViewLayout并实现自定义布局才能实现此效果.这需要相当多的工作,实现以下方法:

覆盖的方法

每个布局对象都应该实现以下方法:

collectionViewContentSize
layoutAttributesForElementsInRect:
layoutAttributesForItemAtIndexPath:
layoutAttributesForSupplementaryViewOfKind:atIndexPath: (if your layout supports supplementary views)
layoutAttributesForDecorationViewOfKind:atIndexPath: (if your layout supports decoration views)
shouldInvalidateLayoutForBoundsChange:
Run Code Online (Sandbox Code Playgroud)

然而,我不清楚如何使补充视图浮动在单元格上方并"粘贴"到视图的顶部,直到到达下一部分.布局属性中是否有这样的标志?

我会使用UITableView但我需要创建一个相当复杂的集合层次结构,这可以通过集合视图轻松实现.

任何指导或示例代码将不胜感激!

iphone view supplementary uitableview uicollectionview

65
推荐指数
4
解决办法
5万
查看次数