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。 –