Xcode只在UiCollectionView中重新加载一个单元格

时间:2015-03-01 11:24:56

标签: ios uicollectionview uicollectionviewcell

我想在UICollectionView中重新加载一个单元格。

我在UITableView知道它是这样的:

[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPathOfYourCell, nil] withRowAnimation:UITableViewRowAnimationNone];

但是UICollectionView呢?

2 个答案:

答案 0 :(得分:6)

使用方法reloadItemsAtIndexPaths

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

答案 1 :(得分:0)

对于Swift 4,请使用以下代码:-

self.collectionView.reloadItems(at: [indexPath!])