gpt4 book ai didi

ios - Collection View :viewForSupplementaryElementOfKind:atIndexPath: called only with UICollectionElementKindSectionHeader

转载 作者:技术小花猫 更新时间:2023-10-29 10:08:25 24 4
gpt4 key购买 nike

我有一个 Collection View ,我希望每个部分都有页眉和页脚。我正在使用默认流布局。

我有自己的 UICollectionReusableView 子类,我在 View Controller 的 viewDidLoad 方法中为页眉和页脚注册了每个子类。

我已经实现了方法 collectionView:viewForSupplementaryElementOfKind:atIndexPath: 但是,对于每个部分,它仅在 kindUICollectionElementKindSectionHeader 时被调用.因此我的页脚甚至都没有创建。

知道为什么会这样吗?

最佳答案

看来我必须为 Collection View 布局设置 footerReferenceSize。奇怪的是我不必对 header 执行此操作。

关于ios - Collection View :viewForSupplementaryElementOfKind:atIndexPath: called only with UICollectionElementKindSectionHeader,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13191480/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com