【问题标题】:Stopping the animation of GIF停止 GIF 的动画
【发布时间】:2014-12-02 20:08:23
【问题描述】:

这里我使用uiimage-from-animated-gif 库通过UIImage 显示动画GIF。它正在工作,但我需要在完全旋转一圈后停止动画,imageView

以下代码:

NSURL *url = [[NSBundle mainBundle] URLForResource:@"dove-animate" withExtension:@"gif"];
self.imageView.image = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];

提前致谢。

【问题讨论】:

标签: ios objective-c iphone cocoa-touch ios8


【解决方案1】:
url = [[NSBundle mainBundle] URLForResource:@"dove-animate" withExtension:@"gif"];
UIImage *testImage = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];
self.imageView.image = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]];
self.imageView.animationImages = testImage.images;
self.imageView.animationDuration = testImage.duration;
self.imageView.animationRepeatCount = 1;
self.imageView.image = testImage.images.lastObject;
[self.imageView startAnimating];



Use the above code it will works

【讨论】:

    猜你喜欢
    • 2014-04-23
    • 2010-10-21
    • 2012-04-06
    • 1970-01-01
    • 2021-09-22
    • 2014-07-01
    • 2011-04-10
    • 2015-03-26
    相关资源
    最近更新 更多