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()
}