Closed
Description
Hey guys,
first of all great library! I have the scenario where I want to be able to animate a GIF only once but I don't want to modify the GIF because on other places I do want the infinitive loop.
I found the loopCount
property on FLAnimatedImage
which when I modify the readonly
flag and set it to 1 gives me exactly the outcome I want.
Is it possible to make it writable without me having to fork it?
Metadata
Metadata
Assignees
Labels
No labels
Activity
Remove readonly flag of loopCount
raphaelschaad commentedon Aug 20, 2015
Hi – thanks for opening this issue.
I'm not convinced yet that making the immutable properties of a GIF writable is the best way to go. Consequently, the same would have to happen e.g. with delay times.
Here is an approach with a loop completion block: https://github.com/Flipboard/FLAnimatedImage/pull/60/files
I'll think more about it. Any input is welcome!
cemo commentedon Aug 20, 2015
#60 seems like a natural fit. Any chance to merge it?
x1024 commentedon May 18, 2016
I would second making the loop count and delay times writable. I tried several different methods to make a gif not loop. It works in a browser, but not in FLAnimatedImage.
I'm not placing any blame in FLAnimatedImage, because GIF is perhaps a more complex standard than is reasonable.
But it would save a great deal of hair-pulling if I could just set an integer property, instead of wrestling with command-line tools that cater to an arcane spec.
dalu93 commentedon Jun 13, 2016
+1
@x1024 I solved with a simple workaround. After each loop is finished, it calls the
loopCompletionBlock
on theFLAnimatedImageView
instance. I have simply implemented it likedharmendrajadav commentedon Sep 26, 2016
@dalu93 How to use loopCompletionBlock in swift 3?
DuongQuangLoc commentedon Oct 28, 2016
@dalu93
In swift 3
self.imageView.loopCompletionBlock = { (uint: UInt) -> Void in
// unit is the loop time of image.
self.imageView.stopAnimating()
}