Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AnimatedImageView] gif repeatCount does not work correctly #1318

Closed
3 tasks done
yikuo123 opened this issue Oct 21, 2019 · 3 comments · Fixed by #1350
Closed
3 tasks done

[AnimatedImageView] gif repeatCount does not work correctly #1318

yikuo123 opened this issue Oct 21, 2019 · 3 comments · Fixed by #1350
Assignees
Labels

Comments

@yikuo123
Copy link

yikuo123 commented Oct 21, 2019

Check List

Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.

Issue Description

I load gif with AnimatedImageView and set repeatCount .finite(count: 1) or .once, it plays two times!

Xcode11.1 + iOS 13.1.3

What

If i set repeatCount repeatCount .finite(count: 0), it did not play;
If i set repeatCount repeatCount .finite(count: 1) or .once, it played two times;
If i set repeatCount repeatCount .finite(count: 2), it played three times;

Reproduce

override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        self.imageView.repeatCount = .finite(count: 1)
        self.imageView.kf.setImage(
            with: LocalFileImageDataProvider(fileURL: xxxx),
            options: [.forceRefresh]
        )
    }

Other Comment

[Add anything else here]

@ibeleliev
Copy link

I can confirm this behaviour for the repeatCount property.
As a workaround i used the AnimatedImageViewDelegate method
animatedImageView(_:didPlayAnimationLoops:)
and the first time the method fires i did what i needed to do after the first end of the gif.

@jahanzebDev
Copy link

I can confirm this behaviour for the repeatCount property. As a workaround i used the AnimatedImageViewDelegate method animatedImageView(_:didPlayAnimationLoops:) and the first time the method fires i did what i needed to do after the first end of the gif.

but using AnimatedImageViewDelegate doesn't give desired result because it stops the animation on first frame instead of last frame.

@ibeleliev
Copy link

I can confirm this behaviour for the repeatCount property. As a workaround i used the AnimatedImageViewDelegate method animatedImageView(_:didPlayAnimationLoops:) and the first time the method fires i did what i needed to do after the first end of the gif.

but using AnimatedImageViewDelegate doesn't give desired result because it stops the animation on first frame instead of last frame.

In my case the animation stopped after the last frame. I was using version 6.3.0 if it matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants