2012-12-11 24 views
0

我需要在xcode中提供一個滑動條來提醒用戶他輸入了錯誤的數據。 我希望它在屏幕的頂部出現約1秒鐘,然後消失,所以用animcation東西並提交,我有這樣的代碼爲它編寫的,它還挺做這項工作,除了Facebook用戶界面行爲,iOS下滑imageview

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:.3]; 
CGPoint center = self.slidingView.center; 
center.y += self.slidingView.frame.size.height; 
self.errorLabel.center = center; 
self.slidingView.center = center; 
self.slidingView.transform = CGAffineTransformMakeRotation(0); 

[UIView commitAnimations]; 

[self.view bringSubviewToFront:self.slidingView]; 
[self.view bringSubviewToFront:self.errorLabel]; 

現在這個problrem是最初slidingview背後卻隱藏着另一個的UIView,但我需要它只是滑下去,現在這出現在一個野蠻的方式(因爲調用bringSubviewToFront的。

任何想法。

回答

0

爲什麼在你進行動畫調用之前你不把子視圖放在前面?

更好的是,隱藏視圖,然後將子視圖放在前面。之後,與您已有的滑動動畫一起進行「淡入淡出」動畫。

+0

因爲我想讓它在它位於後面的控件後面滑動窗體,那麼fronttofront調用只會將它移動到z索引處。 – Kalamantina

+0

對。所以如果你在開始時將前面的子視圖調用到前面,它不應該是震動的(因爲滑動視圖還沒有完全出現) – Msencenb