私はUICollectionViewを作成しました。すべてのセルをiPhoneのスプリングボードの編集モードのように振ってみたいと思います。シェイクコードを作成しましたが、実装方法はわかりません。私はカスタムセルを持っているので、そこに入ると仮定しますが、どのように実装されるのかわかりません。ありがとうございました。UICollectionViewCell Shake
#define degreesToRadians(x) (M_PI * (x)/180.0)
#define kAnimationRotateDeg 0.5
#define kAnimationTranslateX 1.0
#define kAnimationTranslateY 1.0
//startJiggling
int count = 1;
CGAffineTransform leftWobble = CGAffineTransformMakeRotation(degreesToRadians(kAnimationRotateDeg * (count%2 ? +1 : -1)));
CGAffineTransform rightWobble = CGAffineTransformMakeRotation(degreesToRadians(kAnimationRotateDeg * (count%2 ? -1 : +1)));
CGAffineTransform moveTransform = CGAffineTransformTranslate(rightWobble, -kAnimationTranslateX, -kAnimationTranslateY);
CGAffineTransform conCatTransform = CGAffineTransformConcat(rightWobble, moveTransform);
self.transform = leftWobble; // starting point
[UIView animateWithDuration:0.1
delay:(count * 0.08)
options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse
animations:^{ self.transform = conCatTransform; }
completion:nil];
偉大です振とう。目に見える細胞数をプリントアウトし、アレイの数を1つカウントすると、目に見える細胞数は少なくなります。何か案は? NSLog(@ "visibleCellscount%d"、self.collectionView.visibleCells.count); NSLog(@ "birdscount%d"、self.birds.count); – BDGapps
申し訳ありませんが、それ以上のコードはありません... – fguchelaar
しかし、すべてのセルが表示されますか?または最後のものをスクロールする必要がありますか? – fguchelaar