刷新指定单元格:
为了避免重新加载时出现不需要的动画(又名“闪烁”)
BOOL animationsEnabled = [UIView areAnimationsEnabled]; [UIView setAnimationsEnabled:NO]; NSIndexPath *indexPath=[NSIndexPath indexPathForRow:2 inSection:0]; [self.collectionView reloadItemsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil]]; [UIView setAnimationsEnabled:animationsEnabled];
刷指定分区:
if(isCommonUnitEmptyArray(self.model.data)) { [self.collectionView reloadData]; } else{ NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:1]; //为了避免重新加载时出现不需要的动画(又名“闪烁”) BOOL animationsEnabled = [UIView areAnimationsEnabled]; [UIView setAnimationsEnabled:NO]; [self.collectionView reloadSections:indexSet]; // [self.collectionView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic]; [UIView setAnimationsEnabled:animationsEnabled]; }