I have a custom UICollectionViewCell subclass that overwrites initWithFrame: and layoutSubviews to setup its views. However, I\'m now trying to do two
If you want to show animation on selection then following method might helpful to you :
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"cell #%d was selected", indexPath.row);
// animate the cell user tapped on
UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
[UIView animateWithDuration:0.8
delay:0
options:(UIViewAnimationOptionAllowUserInteraction)
animations:^{
[cell setBackgroundColor:UIColorFromRGB(0x05668d)];
}
completion:^(BOOL finished){
[cell setBackgroundColor:[UIColor clearColor]];
}
];
}