1
A
回答
5
- 添加quartzCore作爲一個框架
- 添加進口QuartzCore/QuartzCore.h
使用此代碼
- (void) initController { UIButton *myButton = [view viewWithTag:1]; // Just reference the button you have [myButton addTarget:self action:@selector(animateLabel) forControlEvents:UIControlEventTouchUpInside]; } - (void) animateLabel { CABasicAnimation* highlightAnim = [CABasicAnimation animationWithKeyPath:@"backgroundColor"]; highlightAnim.toValue = (id)[UIColor blueColor].CGColor; highlightAnim.duration = 2; // In seconds highlightAnim.autoreverses = YES; // If you want to it to return to the normal color [label.layer addAnimation:highlightAnim forKey:nil]; }
+0
嗨Ron, 非常感謝。我現在要試一試。 – 2010-08-01 14:23:29
+0
嗨羅恩,我試過這個按鈕。 (做動畫時點擊按鈕)。但沒有任何反應。可能是什麼問題? – 2010-08-01 14:55:31
+0
您不能使用UIButtonRoundRect類型更改UIButton的顏色,因此您無法爲顏色更改設置動畫效果。 如果你需要一個按鈕,你需要創建一個樣式爲UIButtonStyleCustom的UIButton並創建它的外觀。 – 2010-08-01 17:43:47
相關問題
- 1. UILabel動畫文字
- 2. 動畫增量UILabel
- 3. UILabel左右動畫
- 4. 顯示UILabel動畫
- 5. 動畫脈衝UILabel?
- 6. 動畫的UILabel與數字
- 7. 動畫更改UILabel行數
- 8. UILabel的動畫幀順利
- 9. UILabel動畫更改字體
- 10. 更新UILabel文本動畫
- 11. 動畫UILabel尺寸減少
- 12. 更改UILabel顏色動畫
- 13. 如何動畫UILabel的textColor?
- 14. 動畫UILabel不光滑
- 15. 在UITableViewCell中動畫UILabel
- 16. UILabel動畫和手勢
- 17. UILabel動畫數字變化
- 18. UILabel流暢的動畫
- 19. 動畫後出現線UILabel
- 20. 更改UILabel文字動畫?
- 21. 動畫UILabel淡入/淡出
- 22. 滾動的UILabel動畫無法啓動
- 23. 動畫GUI爲iPhone動畫
- 24. UILabel自動佈局高度動畫
- 25. 動畫ipad/iphone
- 26. iphone autorotation動畫
- 27. iphone html動畫?
- 28. 動畫UIImageView iPhone
- 29. Iphone 3D動畫
- 30. Iphone dismissModalViewController動畫
接受一些第一 – vodkhang 2010-08-01 14:46:32
答案你是什麼意思? – 2010-08-01 15:12:28