¿Por qué UICollectionView's UICollectionViewCell no se destaca en el toque del usuario?
Tengo un UICollectionView que se compone de una subclase UICollectionViewCell personalizada. Las celdas se muestran correctamente y responden correctamente a los toques del usuario al disparar este método:
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
Sin embargo, tengo entendido que cuando un usuario toca la celda, debe resaltar (en azul) y luego el resalte debe desaparecer cuando el usuario levanta el dedo. Esto no está pasando. ¿Alguna idea sobre por qué?
Aquí hay un código relevante:
En la fuente de datos de UICollectionView:
@implementation SplitCheckViewCollection
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier = @"ReceiptCellIdentifier";
SplitCheckCollectionCell *cell = (SplitCheckCollectionCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
cell.cellName.text = [NSString stringWithFormat:@"%@%i",@"#",indexPath.row+1];
return cell;
}
En la implementación de UICollectionViewCell:
@implementation SplitCheckCollectionCell
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"SplitCheckCollectionCell" owner:self options:nil];
if ([arrayOfViews count] < 1) {
return nil;
}
if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UICollectionViewCell class]]) {
return nil;
}
self = [arrayOfViews objectAtIndex:0];
}
return self;
}