Giter Club home page Giter Club logo

Comments (8)

pdpraful avatar pdpraful commented on September 28, 2024 3
FLAnimatedImage  *temporaryImage = myAnimatedImageView.animatedImage;
myAnimatedImageView.animatedImage = nil;
myAnimatedImageView.animatedImage = temporaryImage;

The above code did a trick for me.

from flanimatedimage.

raphaelschaad avatar raphaelschaad commented on September 28, 2024

Currently there is no "public" way to do this, but you can very easily mess around with it in FLAnimatedImageView.m. Look at the two properties

// Override of public `readonly` properties as private `readwrite`
@property (nonatomic, strong, readwrite) UIImage *currentFrame;
@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex;

You could call [self stopAnimating];, mess with the indexes, and restart the animation.

What are you trying to achieve? Maybe there's an easier way to do it or a public functionality that could be built.

from flanimatedimage.

zhuhuihuihui avatar zhuhuihuihui commented on September 28, 2024

The FLAnimatedImageView automatically starts to animate the GIF once you set the animatedImage property to it by calling

- (void)setAnimatedImage:(FLAnimatedImage *)animatedImage

Check the source code of this function, at the bottom you should see something like this:

[self updateShouldAnimate];
        if (self.shouldAnimate) {
            [self startAnimating];
        }

Just delete it if you do not want it to start animating automatically, while you can still start animate it manually whenever you want by calling:

[yourAnimatedImageView startAnimating];

from flanimatedimage.

raphaelschaad avatar raphaelschaad commented on September 28, 2024

Thanks @zhuhuihuihui. I'm curious whether @VAlexander wants to achieve something similar to you.

Would you benefit from this being a public property, such as

@property (nonatomic, strong, readwrite) UIImage *shouldStartAnimatingAutomatically; // Default is YES

?

from flanimatedimage.

vicc avatar vicc commented on September 28, 2024

Oh man totally thought I replied to this! @raphaelschaad That would actually be pretty useful to be honest.

from flanimatedimage.

chiahsien avatar chiahsien commented on September 28, 2024

I wish there be a public method called reset or replay, it'd be a great help.
I'm making a walk-through page with GIFs in different pages and I want the GIF image plays from the beginning when it is displayed.

from flanimatedimage.

johngibb avatar johngibb commented on September 28, 2024

Can't you just do:

animagedImageView.animatedImage =  animagedImageView.animatedImage;

to restart the animation?

from flanimatedimage.

timonus avatar timonus commented on September 28, 2024

I think you'd have to set to nil first before setting back to the initial image, because setting that same image on it twice is a no-op. But yes, that should do it.

from flanimatedimage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.