在iOS中将图像叠加在另一个上面

时间:2014-01-30 01:41:35

标签: ios image stack frame swipe

我正在尝试开发一个显示一堆图像的简单应用程序:每个图像都在另一个上面。当您滑动或单击按钮时,第一个图像将消失,其下方的图像将与顶部的图像大小相同(如下图所示,但没有旋转效果)

enter image description here

我试图在每个for循环迭代中获取图像并创建图像的帧:

UIImageView*picture = [[UIImageView alloc] initWithFrame:CGRectMake(40+10*i, 101-10*i, 240-20*i, 200)];
                        UIImage *image = [UIImage imageWithData:imageData];
                        picture.image = image;
                        [dView addSubview:picture];

它有效。但我仍然无法找到如何使第二张图像与其上面的图像大小相同。

1 个答案:

答案 0 :(得分:0)

CGrect nextImageFrame = nextImage.frame;
nextImageFrame.size.width = 240;
nextImageFrame.size.height = 200;
nextImage.frame = nextImageFrame;

假设nextImage是您想要显示的图像