我有图像的水平滚动单节集合视图
当你点击collectionview
中的第一张图片时,图像应该“平滑”过渡以占据整个屏幕,而后面的屏幕会变为全黑。点击图像或右上角的“x”会淡出此屏幕并返回到您之前的屏幕。
我可以从这个方法中获取图像
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
如何实现这种动画?
以下是样本图片,
答案 0 :(得分:0)
请尝试以下代码:
[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);
}];
}];
希望这有帮助!