I would like to change the background color of my custom collection view cell in the didSelectItemAtIndexPath. Here is my implementation.
- (void)collectionView:(UICollectionView *)collectionView
didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
RadioCollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"RadioCollectionViewCell" forIndexPath:indexPath];
[cell setData:self.contentModel andIndexPath:indexPath];
cell.lblChoice.backgroundColor = ColorFromRGB(COLOR_GREEN);
}
Here is my implementation for RadioCollectionViewCell.h
#import <UIKit/UIKit.h>
@interface RadioCollectionViewCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UILabel *lblChoice;
- (void)setData:(ContentModel *)contentModel andIndexPath:(NSIndexPath *)indexPath;
+ (RadioCollectionViewCell *)loadFromNib;
@end
But the background color did not change. When I check the sample solutions, they are just changing the background color of UICollectionViewCell
. Not the custom one. I just want to know that can I do that in the CustomAnnotationView
?