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

PINAnimatedImageView: GIFs Don't Play Nicely with Zoomable UIScrollView #551

Open
LeffelMania opened this issue Jun 10, 2020 · 0 comments
Open
Assignees

Comments

@LeffelMania
Copy link

LeffelMania commented Jun 10, 2020

We've recently upgraded our pod from a very old version to the latest and have run into an issue displaying animated gifs using PINAnimatedImageView that we were not experiencing when the library depended on FLAnimatedImageView. Specifically, setting PINAnimatedImageView.animatedImageView doesn't give the view an intrinsic frame size the way setting .image does. This is an important behavior when implementing a photo viewer that uses PINAnimatedImageView inside of a zoomable scroll view.

I've perused a lot of sample code for implementing a zoomable photo viewer, and they all seem rely on the ImageView's frame to perform layout updates when zooming, just like ours does, so I don't think we're doing anything particularly weird.

Version of the project you're using.

Latest cocoapods release

Installing PINCache (3.0.1-beta.8)
Installing PINOperation (1.1.2)
Installing PINRemoteImage (3.0.0)

Code (or even better whole projects) which reproduce the issue.

This is a project that contains a barebones implementation of our production photo viewer (minus all kinds of bells and whistles and transition animations etc), along with static assets for displaying in it as well as remote images to be downloaded and displayed. You'll find that the images work as expected, but the gifs do not display in the viewer. (Simply tap the image to close the viewer)

I've found a workaround that behaves adequately: setting the ImageView's image to the animationImage.coverImage appears to supply the frame information required for the rest of the layout and zooming logic to work. You'll find 3 small pieces of commented-out code in PhotoViewerViewController.swift that will fix the behavior of the viewer.

PINGifSampleZip.zip

Steps which reproduce the issue.

See project description above.

I'm happy to provide more information, take feedback about anything weird our photo viewer is doing that it shouldn't be, or field other suggestions for working around this behavior. Cheers.

@garrettmoon garrettmoon self-assigned this Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants