3
A
回答
13
動畫GIF不會在iphone動畫。你應該從你的GIF添加一個UIImageView作爲子視圖的UIButton,提取所有圖像和動畫使用動畫的UIImageView
UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
animatedImageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"image1.gif"],
[UIImage imageNamed:@"image2.gif"],
[UIImage imageNamed:@"image3.gif"],
[UIImage imageNamed:@"image4.gif"], nil];
animatedImageView.animationDuration = 1.0f;
animatedImageView.animationRepeatCount = 0;
[animatedImageView startAnimating];
[yourButton addSubview: animatedImageView];
0
在iOS中不支持.gif文件格式。所以要避免在iOS中使用
.gif文件
0
您應該探索使用UIButton
的替代方案,因爲它不允許進行這種定製。例如,您可以使用 UIImageView`作爲按鈕,併爲「觸摸結束」事件設置一個動作。
0
你不能只加載一個gif文件。將gif的每一幀保存到一個單獨的圖像文件(png或類似文件)中 - 例如,您可以使用photoshop來完成此操作,然後使用animationImages將它們加載到UIImage中並執行startAnimating。
相關問題
- 1. 帶動畫的UIButton圖像按鈕
- 2. 帶動畫圖像的UIButton不顯示
- 3. 帶有PHP動畫GIF圖像
- 4. uibutton上的動畫gif
- 5. IOS支持顯示GIF動畫圖像?
- 6. 動畫UIButton背景圖像
- 7. 帶圖像的uibutton
- 8. 帶有JavaScript和CSS的動畫圖像(例如非GIF)?
- 9. JFrame繪製帶有alpha通道的動畫gif圖像
- 10. 動畫JPanel上的.GIF圖像
- 11. 下載Java中的動畫gif圖像
- 12. NSImageView中的動畫GIF圖像
- 13. 帶Jquery的動畫加載Gif?
- 14. iOS圖像動畫
- 15. iOS分享GIF(動畫圖像)不工作
- 16. wpf加載一個gif圖像動畫
- 17. PHP GD圖像 - 輸出動畫GIF
- 18. 動畫GIF大於源圖像
- 19. onclick播放動畫圖像(GIF)
- 20. iOS UIButton比例尺動畫
- 21. jQuery的圖像替換動畫(模擬動畫GIF)
- 22. 動畫GIF圖像作爲iPhone的啓動畫面
- 23. iOS - 動畫UIButton ImageView圖像導致按鈕被選中後
- 24. iPhone:不帶動畫的移動UIButton
- 25. 動畫UIButton圖層?
- 26. UIButton動畫視圖
- 27. jQuery GIF動畫
- 28. ImageMagick:帶透明背景的GIF動畫
- 29. 如何獲取動畫GIF圖像的當前圖像?
- 30. 帶IBAction的IOS UIButton
會[這個相關的問題的答案](http://stackoverflow.com/questions/1679011/implement-animation-in-uibutton)可能幫助你? –
沒有這與我的問題沒有關係。它是當按鈕被按下時的動畫。我想將默認圖像設置爲動畫gif。 –