-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Added a loop completion block #60
Conversation
* Added a completion block on FLAnimatedImageView that is executed when a loop is finished
* Updated example to user loopCompletionBlock
@@ -259,6 +259,10 @@ - (void)displayDidRefresh:(CADisplayLink *)displayLink | |||
if (self.currentFrameIndex >= self.animatedImage.frameCount) { | |||
// If we've looped the number of times that this animated image describes, stop looping. | |||
self.loopCountdown--; | |||
if (self.loopCompletionBlock) { | |||
self.loopCompletionBlock(self, self.loopCountdown); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there the chance to run into a retain-cycle here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how. But I'm not sure of the benefits to pass itself as a parameter anyway. I added it in case any other dev that would use this feature would need it.
Hey! Thanks for your pull request! I left some detailed feedback inline. What were you using this feature for? What's the use case? I'm also curious whether it would not make sense to follow the general delegate pattern that the project is already using. |
Hi Raphael, Thanks for your feedbacks, I'll look into them ASAP and change what needs to be changed :-) My use case is pretty simple : a client of mine asked for a GIF as splash screen. So when one cycle has been made, I just "open the real app". Thanks, |
* LoopCompletionBlock doesn't pass the imageView as parameter anymore * loopLeft parameter became loopCountRemaining * Removed usage demo in example project
Hi Raphael, I made a few changes. Also,
I didn't use the delegate pattern already created because it's marked as intended for debugging purpose (for both |
👍 |
Hi, this is incredibly useful! but Im not following how I can use the loop completion block to run my animation only once |
LGTM! |
Rebased with the current master and merged at 9268e8c. Thanks! |
Great! Thanks 😄 |
No description provided.