微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

UICollection 每 n 行缺少节标题

如何解决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 举报,一经查实,本站将立刻删除。