![](/img/trans.png)
[英]How to reload data in table view by tapping the cell of collection view in swift
[英]How to animate a image from a collection view cell to move to full screen by tapping on it
我有图像的水平滚动单节集合视图
当您在collectionview
点击第一张图像时,图像应以平滑过渡“增长”以占据全屏,而后面的屏幕则逐渐变为全黑。 轻触图像或右上角的“ x”将淡出该屏幕,并使您返回上一屏幕。
我可以从这种方法获得图像
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
如何实现这种动画?
以下是示例图片,
尝试以下代码:
[UIView animateWithDuration:1 animations:^{
//if u want to move it to center before you make it big use all code
imgView.center = self.view.center;
} completion:^(BOOL finished) {
[UIView animateWithDuration:1 animations:^{
//just use this if you want it to move to full screen
imgView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
}];
}];
希望这可以帮助 !
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.