我有一个动画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