CollectionView表示時に右からスライドインするアニメーションをつけた際の備忘録
↑こんなのをつくりたい
実装
- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
CGRect cellRect = cell.frame;
cell.frame = CGRectMake(self.mCollectionCell * indexPath.row + self.view.frame.size.width, cell.frame.origin.y, cell.frame.size.width, cell.frame.size.height);
float value = indexPath.row * 0.1;
[UIView animateWithDuration:1 delay:value options:UIViewAnimationOptionCurveEaseInOut animations:^{
cell.frame = CGRectMake(cellRect.origin.x + self.view.frame.size.width, cellRect.origin.y, cellRect.size.width, cellRect.size.height);
} completion:^(BOOL finished) {
cell.frame = cellRect;
}];
}];
これで右からスライドしてくるcollectionViewを実装できた。
もっといい方法あったら知りたい。。