当前位置: 首页 > news >正文

UICollectionView 的UICollectionReusableView复用 IOS18报错问题记录

- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath 方法复用报错

报错详情:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Expected dequeued view to be returned to the collection view in preparation for display. When the collection view's data source is asked to provide a view for a given index path, ensure that a single view is dequeued and returned to the collection view. Avoid dequeuing views without a request from the collection view. For retrieving an existing view in the collection view, use -[UICollectionView cellForItemAtIndexPath:] or -[UICollectionView supplementaryViewForElementKind:atIndexPath:]. Dequeued view: <CmmentSearchFooterReusableView: 0x7fb3ef3262f0; baseClass = UICollectionReusableView; frame = (0 0; 440 80); clipsToBounds = YES; layer = <CALayer: 0x600002f819e0>>; Collection view: <UICollectionView: 0x7fb3f1821800; frame = (0 0; 440 772.667); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x6000020cf930>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x600002f71660>; contentOffset: {0, 0}; contentSize: {440, 80}; adjustedContentInset: {0, 0, 0, 0}; layout: <CHTCollectionViewWaterfallLayout: 0x7fb3ef51ca80>; dataSource: <RecommendationViewController: 0x7fb3f184fe00>>'

这样写法导致同一个indexPath设置了两个UICollectionReusableView,ios18就报错了,修改如下:每次调用每个indexPath位置上只有一个UICollectionReusableView。

http://www.lryc.cn/news/463533.html

相关文章:

  • Ansible Roles与优化
  • Ubuntu 22.04上安装Miniconda
  • 【MySQL】入门篇—SQL基础:数据定义语言(DDL)
  • 电影评论网站开发:Spring Boot技术详解
  • 20240817 全志 笔试
  • laravel 查询数据库
  • 【Codeforces】CF 2009 F
  • GTP4聊天记录中letax保存为word
  • vscode调试编译找不到gcc,只有cl,但是检查cmd是对的,控制面板的路径也更改了
  • 空间解析几何5-空间圆到平面的距离【附MATLAB代码】
  • [已解决] pycharm添加本地conda虚拟环境 + 配置解释器 - pycharm找不到conda可执行文件
  • SENT - Single Edge Nibble Transmission for Automotive
  • 2024年软件设计师中级(软考中级)详细笔记【7】面向对象技术(下)23种设计模式(分值10+)
  • 未来人工智能的发展对就业市场的影响 人工智能在生活中的相关
  • Oracle EBS 中财务模块
  • 基于SSM公廉租房维保系统的设计
  • 【AI大模型】深入Transformer架构:解码器部分的实现与解析
  • 前端html js css 基础巩固3
  • 如在下载自己的需要的rmp包呢
  • Android TextView实现一串文字特定几个字改变颜色
  • 桃子叶片病害分类检测数据集(猫脸码客 第221期)
  • Vue--》掌握自定义依赖引入的最佳实践
  • repo 命令大全详解(第十四篇 repo overview)
  • 【设计模式】深入理解Python中的抽象工厂设计模式
  • 网站建设完成后,多久需要升级迭代一次
  • 一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字
  • Vue基本学习2
  • 创作者等级权益说明
  • 基于SpringBoot+Vue+uniapp微信小程序的校园反诈骗微信小程序的详细设计和实现(源码+lw+部署文档+讲解等)
  • 统一修改UI库样式的几种方式