UICollectionView 连续插入分区刷新问题

11Pro 以下手机

                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 以上手机必须加入 真他妈的坑

                    self.collectionView.layoutIfNeeded()
                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()
                }
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 夜莺2517阅读 127,757评论 1 9
  • 版本:ios 1.2.1 亮点: 1.app角标可以实时更新天气温度或选择空气质量,建议处女座就不要选了,不然老想...
    我就是沉沉阅读 6,951评论 1 6
  • 我是一名过去式的高三狗,很可悲,在这三年里我没有恋爱,看着同龄的小伙伴们一对儿一对儿的,我的心不好受。怎么说呢,高...
    小娘纸阅读 3,416评论 4 7
  • 我是黑夜里大雨纷飞的人啊 1 “又到一年六月,有人笑有人哭,有人欢乐有人忧愁,有人惊喜有人失落,有的觉得收获满满有...
    陌忘宇阅读 8,601评论 28 53