我想创建一个简单的自定义布局UICollectionView以编程方式使用(即没有界面生成器)。UICollectionView自定义布局。补充意见不显示或查询
我根据文档做的一切:
- 子类
UICollectionViewLayout
并准备我的布局 - 覆盖
layoutAttributesForSupplementaryView(ofKind elementKind: String, at indexPath: IndexPath)
并返回相应的布局属性 - 添加
collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath)
实现,我回到我的补充视图
我的问题是,既没有collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath)
也没有layoutAttributesForSupplementaryView(ofKind elementKind: String, at indexPath: IndexPath)
正在调用,所以我看不到我的补充意见。
我已经仔细检查了我的实现都布局和补充视图创建,但我仍然无法得到它的工作。
可以发布完整的代码吗? –
layoutAttributesForItem()?不是RECT? –