右からスライドインしてくるCollectionViewのアニメーション
4905 ワード
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を実装できた。
もっといい方法あったら知りたい。。
Author And Source
この問題について(右からスライドインしてくるCollectionViewのアニメーション), 我々は、より多くの情報をここで見つけました https://qiita.com/kohei1218/items/9b02fc1c7e6e57a29667著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .