didSelect
メソッドのcollectionview
からセルを削除しようとしました。collectionviewからセクションをリロードする方法
データを削除するとうまくいきます。
しかし、私はこれを取得しています:
理由:「無効なアップデート:セクションの数が無効です。更新(1)の後のコレクションビューに含まれる セクションの数は、更新(2)の前にコレクションビュー に含まれるセクションの数に、 を挿入または削除した数( )に等しい でなければなりません0が挿入され、0が削除されました)。 '
func deleteMovie(cell: MoiveCollectionViewCell) { var indexPath: NSIndexPath = self.collectionView!.indexPathForCell(cell)! // remove and reload data self.collectionView.deleteItemsAtIndexPaths([indexPath]) self.collectionView.reloadSections(NSIndexSet(index: indexPath.section)) }
と
numberOfSectionsInCollectionView
FUNC::私はちょうどセクションの数をリロードしたいfunc numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { //number_per_section = 3 if manager.movie_List.count % number_per_section == 0 { return manager.movie_List.count/number_per_section } else { return manager.movie_List.count/number_per_section + 1 } }
この
は、細胞の機能を削除しています。私は何を追加すべきですか?