UICollection 每 n 行缺少节标题

问题描述

一个奇怪的问题,网上没有找到有同样问题的人。我被卡住了,因为我使用的代码是有限的,不知道这个错误可能来自哪里。

问题 我的特殊问题是每 15 行都缺少该部分。我已经删除了除最低限度之外的所有内容,但是从图像中可以看出,完整的部分背景和所有内容都丢失了。图片底部的白色是该部分的开始。

enter image description here

下面是我正在使用的代码

   override func collectionView(_ collectionView: UICollectionView,viewForSupplementaryElementOfKind kind: String,at indexPath: IndexPath) -> UICollectionReusableView {
        switch kind {
        case UICollectionView.elementKindSectionHeader:
            return updatedHeaders(kind,for: collectionView,at: indexPath)
        default:
            assert(false,"Unexpected element kind")
        }
    }

    
    func updatedHeaders(_ kind: String,for collectionView: UICollectionView,at indexPath: IndexPath) -> MarketHeaderCollectionReusableView {
        return marketHeaders(kind,at: indexPath)
    }
    
     // EDIT: i've tested this code and can confirm that the data is being pulled and that every 15th row is called by what ever system its resposible for this. the issue is that the header is just not visible
    func marketHeaders(_ kind: String,at indexPath: IndexPath) -> MarketHeaderCollectionReusableView {
        
        let header = marketHeaderCollectionReusableView(kind,at: indexPath)
        // i've commented the following out to see if something in here was messing it up,but its still the same,the full section.
        header.name.text = Users[i].Name

        return header
    }

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)