Kullanıcı bir hücreye dokunduğunda bir animasyona 'dan başlamak istiyorum. Fikrim, ilgili hücreyi didSelectItemAtIndexPath
'da seçmek ve bir animasyonu tetiklemekti. Bununla birlikte, bu çalışmaz: (animateWithDuration
5'e ayarlanmış olsa da)Animate UICollectionViewCell on Tap
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
// animate the cell user tapped on
ProductCollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ProductReuseID" forIndexPath:indexPath];
[UIView animateWithDuration:5.0
delay:0
options:(UIViewAnimationOptionAllowUserInteraction)
animations:^{
NSLog(@"animation start");
[cell.layer setBackgroundColor:[UIColor colorWithRed: 180.0/255.0 green: 238.0/255.0 blue:180.0/255.0 alpha: 1.0].CGColor];
}
completion:^(BOOL finished){
NSLog(@"animation end");
[cell.layer setBackgroundColor:[UIColor whiteColor].CGColor];
}
];
}
Aslında, animasyon başlar ve aynı zamanda sona erer. Sonraki girişimi animasyon atlamak için ve sadece örneğin farklı bir sınır stilini ayarlayın: (? El hücreyi yeniden çizmek zorunda muhtemelen çünkü)
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
// animate the cell user tapped on
ProductCollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ProductReuseID" forIndexPath:indexPath];
[cell.layer setBorderWidth:5.0f];
}
Ancak bu şeyi değiştirmez.
Kullanıcı, üzerine dokunduğunda UICollectionViewCell'i nasıl canlandıracağınıza dair herhangi bir fikriniz var mı?
Saygılarımızla Hıristiyan
Çok teşekkürler! Bu sorunu çözdü ... Bunun için – itsame69
OMG, thx. – sabiland