【问题标题】:Xcode reload just one cell in UiCollectionViewXcode 在 UiCollectionView 中仅重新加载一个单元格
【发布时间】:2015-03-01 11:24:56
【问题描述】:

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

我知道UITableView 是这样的:

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

但是UICollectionView呢?

【问题讨论】:

标签: ios uicollectionview uicollectionviewcell


【解决方案1】:

使用名为reloadItemsAtIndexPaths的方法:

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

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-13
      • 2015-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多