我正在删除一个香草UICollectionViewCell
并设置它的背景色:
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCellId forIndexPath:indexPath];
cell.backgroundColor = [UIColor redColor];
当然,每当单元格被回收时,这种颜色就会被设置,即使它从未改变过。
是否有一种方法只在第一次创建单元格时设置颜色,而不为这样的小事对UICollectionViewCell
进行子类化?我之所以这样问,是因为UITableView
不需要子类就允许这样做。
https://stackoverflow.com/questions/20341153
复制相似问题