Questions tagged «supplementary»

13
如何像UITableView纯样式中的节头一样使UICollectionView中的补充​​视图浮动
我正在努力实现的“浮动节头”效果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: 但是,我不清楚如何使辅助视图浮动在单元格上方并“粘”在视图顶部,直到到达下一部分为止。布局属性中是否有此标志? 我会用过,UITableView但我需要创建一个相当复杂的集合层次结构,使用集合视图即可轻松实现。 任何指导或示例代码将不胜感激!
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.