Open hovox opened 5 years ago
Have the same issue with two images applied simultaneously.
if let object = result.alternativeRepresentation as? PINCachedAnimatedImage {
// set image
}
We receive one instance of the image for both views:
<PINCachedAnimatedImage: 0x281911d80> <PINCachedAnimatedImage: 0x281911d80>
I believe there is an easy work around
if let object = result.alternativeRepresentation as? PINCachedAnimatedImage {
let object: PINCachedAnimatedImage = {
guard let data = object.data else {
return object
}
return PINCachedAnimatedImage(animatedImageData: data) ?? object
}()
// set image
}
It might not work in all situations, but it works for me and as a result I get different instances of one image.
<PINCachedAnimatedImage: 0x2837dd100> <PINCachedAnimatedImage: 0x2837e6380>
We also have the same issue
Let's say we have a two
PINAnimatedImageView
instances, if we load same gif url simultaneously for those two image views, only one of them will work. Another one will not load anything.By simultaneously I mean something like this:
Issue happens because only one
PINAnimatedCachedImage
instance is created for those two image views so those two views use samePINAnimatedCachedImage
instance.PINAnimatedCachedImage
hascoverImageReadyCallback
andplaybackReadyCallback
properties which seems not designed to work right in this case. What happens is one image view setscoverImageReadyCallback
andplaybackReadyCallback
properties and another one is overriding them.