【发布时间】:2023-03-08 16:54:02
【问题描述】:
我想像循环列表一样在集合视图中显示单元格,这意味着在集合视图的最后一个单元格之后,滚动集合视图时会显示第一个单元格再次,像 循环链接列表
我尝试过使用 icrousel,但由于 icarosuel 只处理视图,我不想完全完成集合视图并重新开始使用 icarousel,所以有什么办法可以让我的集合视图循环
这是我的collectionView 代码
func collectionView(_ collectionView: UICollectionView,
cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell =
collectionView.dequeueReusableCell(withReuseIdentifier:
"CellName", for: indexPath as IndexPath) as! CellName
let gigModel = self.datasoruce?[indexPath.row]
cell.lblTitle.text = gigModel?.title
cell.btnPrice.setTitle(gigModel?.getPriceAccordingToGigType(),
for: .normal)
cell.itemImageView.sd_setImage(with: URL(string:
(gigModel?.getPhotoPath())!), placeholderImage:
UIImage.init(named: "place_holder"))
cell.itemImageView.layer.cornerRadius = 10.0
if Utilities.isValidString(object: gigModel?.adminId as
AnyObject) {
cell.btnStar.isHidden = false
}
else {
cell.btnStar.isHidden = true
}
return cell
}
我希望这是一个循环列表。
【问题讨论】:
-
处理collectionView滚动,并根据你的collectionView替换数组元素
-
我在理解这一点上有点困难,请您多说一点。谢谢
标签: ios swift uicollectionview icarousel