3
A
回答
7
除非你想要一個更復雜的動畫,你可以創建一個自定義類型的UIButton(通過改變類型的自定義或者與IB或編程方式與UIButton *aButton = [UIButton buttonWithType:UIButtonTypeCustom]
),然後設置按鈕的圖像與[aButton setImage:[UIImage imageNamed:@"wheat_ear" forState:UIControlStateNormal]
。
要移動它,只是動畫的位置通常...
[UIView animateWithDuration:0.5 animations:^{aButton.center = newCenter;}];
或者提供它的現身現場的假象,動畫圖像的邊界,使其與圖像的開始寬度和零高度,並以圖像的寬度和高度結束:
CGRect originalFrame = aButton.frame;
aButton.frame = CGRectMake(originalFrame.origin.x, originalFrame.origin.y, originalFrame.size.width, 0);
[UIView animateWithDuration:0.5 animations:^{aButton.frame = originalFrame;}];
相關問題
- 1. UIbutton flashing動畫
- 2. 動畫UIButton
- 3. UIButton的動畫
- 4. UIButton移動動畫
- 5. UIButton週轉動畫
- 6. 動畫UIButton圖層?
- 7. UIButton動畫視圖
- 8. 動畫選擇UIButton
- 9. UIButton心跳動畫
- 10. UIButton上的動畫
- 11. UIButton上的動畫
- 12. 在動畫視圖時動畫UIButton
- 13. uibutton上的動畫gif
- 14. 動畫UIButton背景圖像
- 15. CGRectContainsPoint爲一個UIButton動畫
- 16. iPhone UIButton自定義動畫
- 17. animateWithDuration不是動畫UIButton
- 18. 用UIButton播放&動畫?
- 19. 的UIButton動畫擴展
- 20. UIButton與UIButtonTypeCustom動畫錯誤
- 21. iOS UIButton比例尺動畫
- 22. 動畫UIButton邊框厚度
- 23. UIButton沒有UIViewAnimationOptionTransitionFlipFromTop的動畫
- 24. 使用UIButton進行動畫
- 25. 將動畫分配給UIButton
- 26. 動畫UIButton文本顏色
- 27. 在UIButton中實現動畫
- 28. iPhone:不帶動畫的移動UIButton
- 29. 定製動畫後的UIButton動作
- 30. 在iOS中隱藏UIButton的動畫
因此,您希望麥穗是按鈕,並且該領域是背景圖像? – Ned 2011-03-16 19:02:44
是的,這是正確的:) – Leon 2011-03-16 19:37:26