iOS动画:从一个小的UIImageView后面滑动一个大的UiImageView

时间:2013-10-22 04:31:48

标签: ios uiimageview

我正在努力正确描述这个问题,但基本上我有一个200像素宽和40像素高的imageView ...在按钮上单击我需要在较小的imageView下面和后面滑动另一个imageView以使其显示好像小imageView是'顶级'。我在下面嘲笑了一个基本的图像......

我熟悉动画代码块但是我的问题是......我不希望largeImageView显示在smallImageView上面...我只希望它在动画块开始后显示在smallImageView下面...

Half animation

Full Animation

编辑:当前动画块:

viewDidLoad中:

//Place small imageView offScreen and hide LargeImageView
_smallImageView.frame = CGRectMake(273, 131, 240, 43);
_LargeImageDropDownView.frame = CGRectMake(45, 131, 229, 43);
_LargeImageDropDownView.hidden = YES;

然后单击它按下的按钮:

-(void)animation
{
//First Animate SmallView to the Left
[UIView animateWithDuration:.5 animations:^{

    _smallImageView.frame = CGRectMake(40, 131, 240, 215);

}completion:^(BOOL finished)
 {
     //Then unhide large view and animate it down
     _LargeImageDropDownView.hidden = NO;
     [UIView animateWithDuration:.5 animations:^{

         _LargeImageDropDownView.frame = CGRectMake(45, 84, 229, 215);

     }completion:^(BOOL finished)
      {
          //completed
      }];
 }];
}

1 个答案:

答案 0 :(得分:1)

尝试更小的ImageView应该放在前面。

将该视图设为:

[self.view bringSubviewToFront:self.smallerImageView];