Giter VIP home page Giter VIP logo

Comments (4)

johncpang avatar johncpang commented on August 17, 2024 1

Seems there is no update for the anti-clockwise animation. So I have a quick solution by inverting the value: (normal, clockwise) from 0.0f -> 1.0f, (invert, anti-clockwise) from 1.0f -> 0.0f. The steps are very simple. After having a working clockwise CircleProgressBar, here are the steps:

Invert the progress value

Everywhere you supply the progress to CircleProgressBar, change the progress to 1.0f - progress.

Example: initial code in viewDidLoad:

[self.circleProgressBar setProgress:(1.0f - 0.0f) animated:NO];

Example: update progress (anywhere in your code):

[self.circleProgressBar setProgress:(1.0f - progress) animated:YES duration:1.0f]; 

Invert the display

Swap the color of progressBarTrackColor with progressBarProgressColor.

Finally, supply your own version of hintGenerationBlock / hintAttributedGenerationBlock. If you don't have one, copy from the CircleProgressBar.m (line 24):

const StringGenerationBlock DefaultHintTextGenerationBlock = ^NSString *(CGFloat progress) {
    return [NSString stringWithFormat:@"%.0f%%", progress * 100];
};

Inside your string or attributed string block, right at the beginning, add progress = 1 - progress;

const StringGenerationBlock DefaultHintTextGenerationBlock = ^NSString *(CGFloat progress) {
    progress = 1 - progress;
    return [NSString stringWithFormat:@"%.0f%%", progress * 100];
};

Done. Enjoy the anti-clockwise CircleProgressBar now.

from circleprogressbar.

Eclair avatar Eclair commented on August 17, 2024

Thanks @SagarSDagdu, It sounds like interesting idea. I think we can define this property inside the control and change calculations in draw method a little to achieve this.
I will try to look into it later, but let me know if you want to do it yourself.

Thanks!

from circleprogressbar.

bintu1234 avatar bintu1234 commented on August 17, 2024

can we use this control for uitableview cell .Like in chat screen i need to perform some animation while image is loading.if yes how to handle like every time it is loading .Please help me.

from circleprogressbar.

SagarSDagdu avatar SagarSDagdu commented on August 17, 2024

@bintu1234
[progressView setProgress:(bytesDownloaded/totalBytes) animated:YES]; is a simple snippet that will help you achieve what you are trying.

from circleprogressbar.

Related Issues (16)

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.