Comments (4)
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.
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.
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.
@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)
- IB_DESIGNABLE for CircleProgressBar Not Working HOT 1
- Set line cap HOT 3
- Start angle defaults to 90 HOT 1
- Transparent hintViewBackgroundColor HOT 3
- How to create two lines Inside the circle Progress Bar? HOT 1
- Action (User Input) HOT 1
- Add setHintAttributedStringGenerationBlock method HOT 8
- Progress Duration is Wrong HOT 6
- Error with hint text generation block example HOT 2
- How to handle animation completion? HOT 5
- How do we do the track tickness
- Background is black no matter what HOT 3
- Custom progress change animation time
- Duration HOT 6
- CircleProgressBar doesn't update progress value when animated change method is called very often HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from circleprogressbar.