

示例
實現(xiàn)思路
動畫縮放連續(xù)性強,所以點擊圖片后,在該控制器中添加對應(yīng)的大圖 view。
視圖層級
View
UICollectionView
cell
UIImageView
實現(xiàn)難點
放大過程:
-
在大圖上添加一個用于完成動畫的 imageView,其中該 imageView 的初始位置要等于點擊的小圖的位置,所以這里需要將小圖的 frame 轉(zhuǎn)換到大圖上
CGRect rect = [collectionView convertRect:cell.frame toView:_imgV]; -
獲取到 frame 后,完成動畫
[UIView animateWithDuration:1 animations:^{ tempV.bounds = _imgV.frame; tempV.center = _imgV.center; } completion:^(BOOL finished) { [tempV removeFromSuperview]; _imgV.image = [UIImage imageNamed:[NSString stringWithFormat:@"%ld",indexPath.row + 1]]; }];
縮小過程:
該過程與放大過程類似
以上觀點為本人學(xué)習(xí)記錄,僅供參考,最后放上工程鏈接