I want to reload just one cell in a UICollectionView
.
I know in UITableView
it is something like this :
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPathOfYourCell, nil] withRowAnimation:UITableViewRowAnimationNone];
but what about UICollectionView
?
For the listing details of each item, people use UITableView because it shows more info on each item. The UICollectionView class manages an ordered collection of data items and presents them using customizable layouts.
A layout object that organizes items into a grid with optional header and footer views for each section.
There are no section headers in the UICollectionView. So for your first task, you'll add a new section header using the search text as the section title. To display this section header, you'll use UICollectionReusableView .
This method asks the data source object to provide a supplementary view to display in the collection view. It asks the datasource object whether the specified item can be moved to another location in the collectionview. This method moves the specified item to the specified indexpath.
Use the method called reloadItemsAtIndexPaths:
[self.collectionView reloadItemsAtIndexPaths:@[indexPathOfYourCell]];
For swift 4 use this code:-
self.collectionView.reloadItems(at: [indexPath!])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With