[英]Expand and collapse animation not working in ios6
我正在UIView
工作。 單擊按鈕后,該視圖將展開和折疊。 它可以在iOS <= 5上運行,但不能在iOS6上運行 。 您能否更正我的代碼或對其進行解釋。
謝謝。
我的代碼:
CGFloat x= 60,y = 391,w1=210,h1=48;
[ViewShare setHidden:YES];
[UIView beginAnimations:@"animationOff" context:NULL];
[UIView setAnimationDuration:0.2f];
[ViewShare setFrame:CGRectMake(x, y, w1, h1)];
[UIView commitAnimations];
和參考頁
謝謝..
瑪尼,您應該改用基於塊的動畫,因為在iOS 4.0之后不建議使用提交動畫。
如果您嘗試跨很多IOS,並嘗試使用“不推薦使用”的方法,則會有大量的GUI錯誤代碼。 順便說一句,您的代碼是正確的。
如果您在4.0之前不使用IOS,請改用
animateWithDuration:animations:completion:
這是一個例子:
[UIView animateWithDuration: 0.2f
animations:^{
[ViewShare setFrame:CGRectMake(60, 391, 210, 48)];
}
completion:^(BOOL finished){
// what you want when the animation is done
}];
請注意,有時您需要根據iOS版本切換行為,這始終與GUI相關。 那讓我非常緊張。 :)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.