ios 如何在cell中去掉_ios – 如何在重新加载时清除UICollectionViewCell?

我有一个问题,即UICollectionView中显示的数据会覆盖标签,并且单元格视图不会被清除.

此图显示了问题,

IE:

52806b045822c5b713ec005a57999876.png

我的UICollectionViewCell是这样构建的;

// in viewDidLoad

self.playerHUDCollectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier:reuseIdentifer)

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

let cell:UICollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifer, for: indexPath) as UICollectionViewCell

let arr = UINib(nibName: "EYPlayerHUDView", bundle: nil).instantiate(withOwner: nil, options: nil)

let view = arr[0] as! EYPlayerHUDView

cell.contentView.addSubview(view)

if let allPlayers = self.allPlayers

{

let player:EYPlayer = allPlayers[indexPath.row]

view.updatePlayerHUD(player: player)

}

cell.layoutIfNeeded()

return cell

}

我使用视图在单元格中显示.

我尝试删除cellForItemAt中的所有单元格的子子节点,但它似乎删除了所有子视图.

我想知道如何清除UICollectionViewCell,因此UICollectionViewCell上的标签和其他信息不像上面的例子那样脏.

非常感谢

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值