是否可以像 UITableView headerView 一样创建 UICollectionView 标题 View ?我的意思是整个集合 View 的标题 View ,而不是每个部分的重复 View 。就像我想要的图片一样,现在我已经完成的图片。
最佳答案
我现在有了解决方案。在 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/