gpt4 book ai didi

swift - UICollectionView 标题 View 类似于表格 View 标题(不是节标题)

转载 作者:行者123 更新时间:2023-12-04 15:59:45 26 4
gpt4 key购买 nike

是否可以像 UITableView headerView 一样创建 UICollectionView 标题 View ?我的意思是整个集合 View 的标题 View ,而不是每个部分的重复 View 。就像我想要的图片一样,现在我已经完成的图片。

PictureOne

PictureTwo

最佳答案

我现在有了解决方案。在 collectionView 中添加一个 subview ,并使 collectionView contentInset 位于 topImageView 下方,如下所示。

    topImageView.frame = CGRect(x: 5*SCREEN_SCALE, y: -125*SCREEN_SCALE, width: 285*SCREEN_SCALE, height: 120*SCREEN_SCALE)
collectionView.addSubview(topImageView)
collectionView.contentInset = UIEdgeInsets(top: 130*SCREEN_SCALE, left: 0, bottom: 0, right: 0)

关于swift - UICollectionView 标题 View 类似于表格 View 标题(不是节标题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50832354/

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