didSelectItemAtIndexPathのカスタムコレクションビューセルの背景色を変更したいと思います。 これは私の実装です。ここでカスタムCollectionViewCellの背景色を変更するには?
- (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);
}
は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
しかし、背景色が変更されていないため、私の実装です。サンプルソリューションをチェックすると、彼らはちょうどUICollectionViewCell
の背景色を変更しています。カスタムなものではありません。私はちょうど私がCustomAnnotationView
でそれを行うことができます知りたいですか?
もっとコードを入力してください。 –