前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >UICollectionView 连续插入分区刷新问题

UICollectionView 连续插入分区刷新问题

作者头像
developerbfl
发布2021-03-05 11:01:10
8340
发布2021-03-05 11:01:10
举报
文章被收录于专栏:iOS 开发iOS 开发

11Pro 以下手机

代码语言:javascript
复制
                if self.arrDataSource.count > 1 {
                    var insertIndexPathMap = [IndexPath]()
                    let section = self.arrDataSource.count - 1
                    for index in 0..<similarModelList.count {
                        let indexPa = IndexPath(item: index, section: section)
                        insertIndexPathMap.append(indexPa)
                    }
                    self.collectionView.performBatchUpdates({
                        self.collectionView.insertSections(IndexSet(integer: section))
                        self.collectionView.insertItems(at: insertIndexPathMap)
                    }) { (finish) in
                        if finish {
                            print("90900900")
                        }
                    }
                } else {
                    self.collectionView.reloadData()
                }

11Pro 以上手机必须加入 真他妈的坑

代码语言:javascript
复制
                    self.collectionView.layoutIfNeeded()
代码语言:javascript
复制
                if self.arrDataSource.count > 1 {
                    var insertIndexPathMap = [IndexPath]()
                    let section = self.arrDataSource.count - 1
                    for index in 0..<similarModelList.count {
                        let indexPa = IndexPath(item: index, section: section)
                        insertIndexPathMap.append(indexPa)
                    }
                    self.collectionView.performBatchUpdates({
                        self.collectionView.insertSections(IndexSet(integer: section))
                        self.collectionView.insertItems(at: insertIndexPathMap)
                    }) { (finish) in
                        if finish {
                            print("90900900")
                        }
                    }
                } else {
                    self.collectionView.reloadData()
                    self.collectionView.layoutIfNeeded()
                }
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 11Pro 以下手机
  • 11Pro 以上手机必须加入 真他妈的坑
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档