I'm using swift 2.2 and i have a collectionview inside cell ia hve a label.I want to change a label text value in UICollection view on a button click without using reloading whole uiCollection view. I can't use collectionView.reloadData() for my scenario. I want a do it without using it. Just to update one label in a particular item in collectionview. Any help??
If you pass the IndexPath you can access the cell, then from it you can change the label using this syntax
let cell = self.collectionView.cellForItem(at: IndexPath) as? yourCollectionViewCellName
cell.label.text = "new text"
You can do it by this way:
let indexPath = NSIndexPath(forRow: row, inSection: 0)
tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
It will not reload your complete UICollectionView
.
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