2013-10-22 50 views
0

我很努力地正確地描述這個問題,但基本上我有一個imageView是200像素寬,40像素高...在按鈕上點擊我需要滑動另一個imageView在較小的imageView下面和後面,使其看起來好像小圖像視圖是「頂部」。我嘲笑了下面的基本圖像...iOS動畫:從一個小的UIImageView背後滑動一個大的UiImageView

我熟悉動畫代碼塊,但我的問題是...我不希望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; 

它的按鈕。然後的onClick:

-(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

嘗試類似的東西,小的ImageView應走在了前面。

通過設置這一觀點爲:

[self.view bringSubviewToFront:self.smallerImageView]; 
+0

感謝您的...它的工作原理使SmallerImageView的條款。問題是,雖然當大圖像是在小圖像背後,它仍然可以在小視圖上方看到..我將用圖像更新這個問題,這更清晰一點。 –

+0

我很困惑,如果你初始化LargeImageView從小的ImageView。那麼它不應該發生吶? –

+0

你是如何從小ImageView初始化LargeImageView的? –