我有兩個的UIButton讓說:淡入淡出動畫上UIButtons
的UIButton *產品 的UIButton *下個產品
我設置上的每個按鈕的圖像相對於該產品。
我想動畫按鈕的方式是一個按鈕淡出而第二個淡出。
好心幫我出
我有兩個的UIButton讓說:淡入淡出動畫上UIButtons
的UIButton *產品 的UIButton *下個產品
我設置上的每個按鈕的圖像相對於該產品。
我想動畫按鈕的方式是一個按鈕淡出而第二個淡出。
好心幫我出
裹你想UIView beginAnimations
和UIView commitAnimations
間動畫的變化。
[UIView beginAnimations:nil context:nil];
product.alpha = 0;
nextProduct.alpha = 1;
[UIView commitAnimations];
查看UIView文檔以瞭解如何自定義時間和外觀。
我會使用新的塊API。我不知道第一個答案是否會讓用戶在動畫過程中與控件進行交互。我有類似的情況,並使用下面的代碼。關鍵是選項:UIViewAnimationOptionAllowUserInteraction
[UIView animateWithDuration:0.5f
delay:0.0f
options:UIViewAnimationOptionAllowUserInteraction
animations:^(void) {
[product setAlpha:0.0f];
[nextProduct setAlpha:1.0f];
} completion:^(BOOL finished) {
//Maybe set the new alpha here when the first animation is done?
}];
退房:http://www.developerfeed.com/ios/tutorial/ios-fade-and-fade-out-view-effects – CarlJ