How to show a GIF on iOS in a certain frame, not show it until fully loaded, and allow zoom?

Viewed 2809

When a user selects a GIF, I want to present an overlay on top of everything showing the GIF.

I know there's a few ways on iOS to do this. There's the great UIImage+animatedGIF which works decently well, but for longer GIFs they're very slow and don't play back at the same speed as a UIWebView would (which plays at the accurate playback speed).

It sucks, because if that category didn't play them back slowly it would do everything I need.

But it doesn't, so I tried with UIWebView, however I'm confused about three things:

  1. How do I get size that the UIWebView should be when presented (its frame)? Would I have to download the GIF first as a UIImage then check its size property? Is there a better way (might take awhile)?

  2. How do I stop it from playing until it's fully loaded?

  3. With the above category, as it's just a UIImage, when I embed it as a UIImageView in a scrollview it's very easy to zoom in and out of. Is this possible with a UIWebview?

5 Answers
Related