大家.. 如何設置按鈕點擊動畫?UIButton上的動畫點擊iPhone
我有兩個按鈕,兩者具有不同的幀..
First CGRectMake (10 , 10 , 100 , 80); It has Black Image,
Second CGRectMake (200, 10 , 210 , 80); It has White Image,
當我點擊者的第一個按鈕,它應該以動畫從一幀移動到另一幀..
只有見過像第一的按鈕黑色圖像移動到第二個按鈕的位置。像按鈕的圖像變化..
後點擊按鈕框架不會改變......應該繼續作爲第一和第二..
我都試過,但沒有得到確切的
buttonFirst.frame = buttonSecond.frame;
buttonFirst.center = buttonSecond.center;
buttonFirst.transform = CGAffineTransformMakeTranslation(buttonSecond.frame.origin.x - buttonFirst.frame.origin.x , buttonSecond.frame.origin.y - buttonFirst.frame.origin.y);
如何製作動畫呢?
EDITTING:
我需要從一個的CGRect移動一個棋子到另一種的CGRect。所以,它要顯示像移動棋子,但我不想改變的CGRect,只有按鈕圖像看起來像這樣.. 。
請告訴我.. 謝謝...
是,還..這裏是一個代碼..的UIImageView * ImageView的= [[ALLOC的UIImageView] INIT]; [imageView setFrame:button.frame]; [imageView setImage:buttonS.currentBackgroundImage]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:2.0]; [imageView setFrame:buttonS.frame]; [UIView commitAnimations]; [imageView removeFromSuperview];但沒有工作.. –