licroa 2020-01-08 18:35 采纳率: 0%
浏览 530

swift invalid number of items in section 0

collection view报错
代码如下:
let selectIndex = self.photoData.seletedAssetArray.index(of: self.previewPhotoArray[currentIndex])
if selectIndex != nil{
self.rightButton.asyncSetImage(UIImage.zyCreateImageWithView(view: ZYPhotoNavigationViewController.zyGetSelectNuberView(index: "(selectIndex! + 1)")), for: .selected)
}

        if selectIndex != nil{
            if self.rightButton.isSelected == false {
                let indexPath = IndexPath.init(row: selectIndex!, section: 0)
                self.photoData.seletedAssetArray.remove(at: self.photoData.seletedAssetArray.index(of: self.previewPhotoArray[currentIndex])!)
                thumbnailCollectionView.deleteItems(at: [indexPath])
            }else{
                let indexPath = IndexPath.init(row: selectIndex!, section: 0)
                thumbnailCollectionView.insertItems(at: [indexPath])
                thumbnailCollectionView.reloadItems(at: [indexPath])
                thumbnailCollectionViewCellToggeleSelect(indexPath: indexPath)
            }
        }

报错信息:
'Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (1) must be equal to the number of items contained in that section before the update (1), plus or minus the number of items inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out)

希望指教,谢谢

  • 写回答

2条回答

  • zqbnqsdsmd 2020-01-09 00:14
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献