2010-11-22 44 views
0

我在程序中向UIView添加動畫。視圖中有很多控件。我試圖在動畫之前隱藏一些控件,因此我將隱藏屬性設置爲YES。但它不起作用。在動畫過程中它仍然可見。如何在UIView動畫之前更新UI

這裏是一些代碼:

button.hidden = YES; 
[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:1.0f]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES]; 
[UIView commitAnimations] 

可以在任何一個可以告訴我如何隱藏動畫前控制? 或如何。如果你想動畫一個觀點,即設置它的新價值,像(button.hidden = YES)聲明更新控制雕像(控制位置,可見等)

感謝

回答

0

,應設在你的動畫塊內,像這樣。

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:1.0f]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES]; 
button.hidden = YES; 
[UIView commitAnimations]; 
+0

對不起,我沒有嘗試在動畫過程中更改按鈕的聲明,我嘗試在動畫之前更改聲明。當動畫開始時,我希望這個按鈕已經不可見,謝謝 – user515909 2010-11-23 04:07:24

+0

你可以發佈有關'按鈕'創建地點的代碼嗎? – 2010-11-23 19:44:40