1、首先需要实现这个方法
_resourceCollectionView.allowsMultipleSelection = YES;//实现多选必须实现这个方法2、
2、然后实现以下两个方法即可
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
ResourceCollectionViewCell *cell = (ResourceCollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
cell.label.backgroundColor = ColorFrom16(0xFFEFE5);
}
- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath
{
ResourceCollectionViewCell *cell = (ResourceCollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
cell.label.backgroundColor = ColorWhite;
}