我有一個動畫gif(如this之一),當我在iphone應用程序的圖像視圖中顯示時,它只顯示第一幀。這種行爲與蘋果文檔一致。 我想知道什麼是最好的方式來實現這一點在iphone上?我如何在iphone上顯示圖像動畫
0
A
回答
2
這是我在當前項目中獲得的一些代碼。我有一個循環將圖像standy2通過standby7.png到數組中。我使用imageWithContentsOfFile,因爲在內存使用上似乎稍微好一點。
standbyAnimationImages = [[NSMutableArray alloc] init];
for (NSUInteger i=2; i<=7; i++) {
filename = [NSString stringWithFormat:@"standby%d", i];
[standbyAnimationImages addObject:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:filename ofType:@"png"]]];
}
imageViewAnimation.animationImages = standbyAnimationImages;
imageViewAnimation.animationDuration = 2;
imageViewAnimation.animationRepeatCount = 0;
[imageViewAnimation startAnimating];
希望這可以幫助你。
1
將其拆分爲單獨的PNG或JPG圖像,然後將每個幀加載到UIImageView
並使用其動畫方法。看看「動畫圖像」下的UIImageView
文檔。這非常簡單。
0
如果您導出所有幀單獨的圖像,你可以做一個UIImage
視圖中,animationImages
屬性設置爲NSArray
包含所有幀作爲UIImages
。然後致電[imageView startAnimating]
。
Kyle
相關問題
- 1. 在Android上顯示動畫圖像
- 2. 如何在Android應用上顯示啓動畫面圖像?
- 3. 如何在懸停上創建顯示圖像動畫效果?
- 4. 顯示動畫圖像
- 5. Iphone Mapkit:在地圖上顯示圖像
- 6. 如何在ios上顯示webview上的圖像混合像flash動畫?
- 7. 圖像與動畫在iphone
- 8. 如何在iPhone中顯示.tiff圖像?
- 9. 在畫布上隨機顯示圖像
- 10. JS圖像未顯示在畫布上
- 11. 圖像不顯示在畫布上(Java)
- 12. 在iPhone上不顯示背景圖像
- 13. 如何在UINavigationController iphone上呈現的按鈕上顯示圖像?
- 14. 如何在iPhone上實現2D圖像動畫?
- 15. 只在畫像顯示UIPopover在iPhone 6+
- 16. 如何在mainform上顯示動畫?
- 17. 顯示圖像在gridview + iphone
- 18. 如何在iPhone上顯示條形圖?
- 19. iPhone圖像顯示
- 20. 我如何顯示圖像?
- 21. Qt - 如何在QGraphicsPixmapItem中顯示gif(動畫)圖像
- 22. 如何在按鈕上方顯示動畫視圖,如UIAlertView
- 23. 如何在iPhone上的GridView中顯示圖像
- 24. 如何在iphone上觸摸事件突出顯示圖像
- 25. jQuery自動完成:如何顯示動畫GIF加載圖像
- 26. 與動畫在屏幕上的JavaScript顯示圖像
- 27. Blackberry:如何在屏幕上滑動位圖圖像以顯示下一個/其他圖像?某種動畫?
- 28. HTML5畫布顯示和拖動圖像
- 29. 啓動畫面中未顯示圖像
- 30. IOS支持顯示GIF動畫圖像?
Duplicate http://stackoverflow.com/questions/899472/how-do-i-show-image-animation-on-iphone – ChrisF 2009-05-22 19:07:20