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
- 2. UIbutton flashing動畫
- 3. UIButton的動畫
- 4. UIButton移動動畫
- 5. 動畫選擇UIButton
- 6. UIButton週轉動畫
- 7. UIButton動畫視圖
- 8. 動畫UIButton圖層?
- 9. UIButton圖像動畫
- 10. UIButton上的動畫
- 11. 在動畫視圖時動畫UIButton
- 12. animateWithDuration不是動畫UIButton
- 13. 動畫UIButton文本顏色
- 14. 的UIButton動畫擴展
- 15. 在UIButton中實現動畫
- 16. UIButton與UIButtonTypeCustom動畫錯誤
- 17. 動畫UIButton邊框厚度
- 18. 動畫UIButton背景圖像
- 19. iPhone UIButton自定義動畫
- 20. 將動畫分配給UIButton
- 21. 添加選擇動畫到一個UIButton
- 22. 動畫停止後刪除UIButton
- 23. UIButton AppStore購買按鈕動畫
- 24. UIButton動畫無法正常工作
- 25. UIButton的翻轉動畫在循環
- 26. 在動畫中間禁用UIButton
- 27. 動畫UIButton放大和縮小點擊
- 28. UIButton上的動畫點擊iPhone
- 29. UIModalTransitionStylePartialCurl導致UIButton文字動畫
- 30. 動畫時UIButton沒有響應
因此,您希望麥穗是按鈕,並且該領域是背景圖像? – Ned 2011-03-16 19:02:44
是的,這是正確的:) – Leon 2011-03-16 19:37:26