giulio92 / GLTableCollectionView

Netflix and App Store like UITableView with UICollectionView, written in pure Swift 4.2
MIT License
705 stars 37 forks source link

Add/Delete Sections and Add/Delete CollectionView Cells #11

Closed nelsaow closed 7 years ago

nelsaow commented 7 years ago

Hi Giulio!

Great Project! Do you have any writing about Add/Delete Sections and Add/Delete CollectionView Cells from user interface, can you help me please. Thanks

giulio92 commented 7 years ago

Hello @nelsaow,

You can add and delete UICollectionViewCells simply by calling UICollectionView's reloadData method, be sure to update the value inside collectionView(_:numberOfItemsInSection:) before calling it. So for example if you have 20 UICollectionViewCells in a UICollectionView and you want to delete one or more just update the numberOfItemsInSection value from 20 to whatever number and call reloadData on the UICollectionView you're pointing to. Since GLTableCollectionView is a UITableViewController you could also just call the reloadData method on the GLTableCollectionView to reload and update all the UICollectionViews with a single action.