从 VC 更新单个 UICollectionviewCell



所以我有一个VC,允许ppl向集合视图中列出的任何用户发送朋友请求,我想在请求等待响应时从添加按钮切换到加载指示器,但我不确定如何在不调用[self.collectionview reloadData]的情况下执行此操作,有没有办法临时更改单个单元格的外观w.重新加载整个集合视图?

如果你知道 UICollectionViewCell 指针 - 调用

NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell];
[self.collectionView reloadItemsAtIndexPaths:@[indexPath]];

使用方法 reloadItemsAtIndexPaths 作为-

[self.collectionView reloadItemsAtIndexPaths:@[indexPathOfYourCell]];

最新更新