GithubHelp home page GithubHelp logo

danielamitay / dacircularprogress Goto Github PK

View Code? Open in Web Editor NEW
2.4K 2.4K 341.0 650 KB

DACircularProgress is a UIView subclass with circular UIProgressView properties.

License: Other

Objective-C 95.97% Ruby 4.03%

dacircularprogress's People

Contributors

0xced avatar bfolkens avatar chrisjp avatar cuongtv51 avatar danielamitay avatar jeffnuss avatar loic avatar maratal avatar markrickert avatar michaelpetrov avatar premekptacek avatar ryancopley avatar scalessec avatar seivan avatar sochalewski avatar timle8n1 avatar toddreed avatar tomasandrle avatar travisjbeck avatar vanderneut avatar wdragen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dacircularprogress's Issues

Setting indeterminate property when progress view has no window has no effect

The value of the indeterminate property is based on the presence of the spin animation on the view's layer. This causes an issue when attempting to set the indeterminate property to YES when the view doesn't belong to a window because the animation is not preserved when the view is moved to a window; iOS seems to remove all animations when a view is added to a window.

Could make it look like ProgressHUD

Could make it easier to user like ProgressHUD. Show it can show default in center then users can not touch any areas else....
And easy to call the method like show and hide...

Can not be showed successfully when make it as a component of my self-defined view when load from xib

I have a self-defined view. And it has a DACircularProgressView as subview.

@interface TestView : UIView
{
    DACircularProgressView *_progressView;
}
@property(nonatomic, strong)DACircularProgressView *progressView;

And I want this TestView loaded from xib files. So my implementation file as below:

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self _myInitialize];
    }
    return self;
}

- (void)awakeFromNib
{
    [self _myInitialize];
}

- (void)_myInitialize
{
    _progressView = [[DACircularProgressView alloc] initWithFrame:self.bounds];
    _progressView.trackTintColor = [UIColor grayColor];
   _progressView.progressTintColor = [UIColor greenColor];

   [self addSubview:_progressView];
}

When add my TestView to my view controller's xib file, I can't see the right progress view. While when I alloc my TestView in viewDidLoad method, and add it to my self.view, I can see the right progress view. I want know why? Is there any mistake I have made? Thanks advance.

iOS 10 compatibility

I'm sorry to tell you, but your library doesn't build in iOS 10 anymore.

Here is the Fix:

DACircularProgressView.h line 11

replace:

@interface DACircularProgressView : UIView

with:

#if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_0
@interface DACircularProgressView : UIView
#else
@interface DACircularProgressView : UIView <CAAnimationDelegate>
#endif

Set target value dynamically

Hi,
First of all thank you for the repository, we have used it in our application and its working good.
We are struggling to set maximum value to it dynamically(Default one is 1.0f). And also we have used labelled circular so there its just UI issue the label is some what bigger in size so its overlapping with circle.
Thanks. Appreciate feedback on this.

Empty circularProgress when 100%

I was experiencing an empty circularProgress when setting 100%
changing the arc initialization to CGFloat radians = DEGREES_2_RADIANS((self.progress*360.0f)+270); appeared to fix the issue

Indeterminate speed on instantiation

I'm noticing that if I create a progress view and set the "indeterminate" property to YES then it spins about 4x faster than normal.
So I have something like:

DACircularProgressView *progressView = [[DACircularProgressView alloc] initWithFrame:CGRectMake(50, 50, 50, 50)];
progressView.roundedCorners = YES;
progressView.progress = 0.65;
progressView.indeterminate = YES;
[self.view addSubview:progressView];

But if I set the indeterminate property to YES a few seconds later then it adjusts down to the correct speed. Any ideas on how I can instantiate the view in indeterminate mode without it spinning super fast?

Please add semantic version tags

I’ve recently added DACircularProgress to the CocoaPods package manager repo.

CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, DACircularProgress doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.

Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.

In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:

$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags

is it possible to set maximum and minimum value?

hi,your library is awesome.I need to set maximum value and minimum value.
I am trying this code for setting 2mins as maximum value.

-(void)progressChange{
//CGFloat progress = self.largeProgressView.progress+(totalOne/100)+0.011;
CGFloat progress = self.largeProgressView.progress+(totalOne/1000)+0.0083;

NSLog(@"totttal------>%d",totalOne);

if (totalOne>0) {
    n=n+1;
    totalOne--;
    [self.largeProgressView setProgress:progress animated:YES];

}else{
    [self.timer invalidate];
    self.largeProgressView.progress=0;
    NSLog(@"%d",n);
    NSLog(@"completed");
}

}

where total one is 120 secs.

My value is static so i going with this and working fine..
If i have any other value i need to change this.is there any property for setting maximum value?

The track animation flickers while loading.

Here is my code. Is it because of the decimal value?

   progressBlock: { (progress: Int32) -> Void in
                if progress <= 99 {

                    self.progressView.setProgress(CGFloat(progress)/100, animated: true)

                    print("CG value: \(CGFloat(progress)/100)")

                    print(self.progressView.progress)

                } else {

                    self.progressView.removeFromSuperview()
                }


        }

CocoaPod Issue?

When I use cocoa pods:

pod 'DACircularProgress', '2.1.0'

I get a header that seems to be missing a function (specifically the clockwiseProgress call). If i download off GIT doesn't seem to be an issue. Any suggestions?

-- the CocoaPod header is below --

//
// DACircularProgressView.h
// DACircularProgress
//
// Created by Daniel Amitay on 2/6/12.
// Copyright (c) 2012 Daniel Amitay. All rights reserved.
//

import <UIKit/UIKit.h>

@interface DACircularProgressView : UIView

@Property(nonatomic, strong) UIColor *trackTintColor UI_APPEARANCE_SELECTOR;
@Property(nonatomic, strong) UIColor *progressTintColor UI_APPEARANCE_SELECTOR;
@Property(nonatomic) NSInteger roundedCorners UI_APPEARANCE_SELECTOR; // Can not use BOOL with UI_APPEARANCE_SELECTOR :-(
@Property(nonatomic) CGFloat thicknessRatio UI_APPEARANCE_SELECTOR;
@Property(nonatomic) CGFloat progress;

@Property(nonatomic) CGFloat indeterminateDuration UI_APPEARANCE_SELECTOR;
@Property(nonatomic) NSInteger indeterminate UI_APPEARANCE_SELECTOR; // Can not use BOOL with UI_APPEARANCE_SELECTOR :-(

  • (void)setProgress:(CGFloat)progress animated:(BOOL)animated;

@EnD

Potential Feature: Indeterminate State?

I am putting this out here to test the waters: What do you think about adding an indeterminate property to DACircularProgress?

The idea is that while indeterminate, the circular progress view itself will rotate (progress property is still utilized). The most common example is the tab loading indicator in Chrome. Adding this property to DACircularProgress would make such an implementation trivial.

I am fond of this style because it immediately indicates to the user that work is being done, but handles scenarios where there is no loading progress for a non-negligible amount of time.

Example with both progress being incremented, and indeterminate true:

indeterminate

Any thoughts?

Flash on setting progress

On setting progress to 0.f using set progress the circular progress animates to 0 then seems to flash the previous value

Stop animation on some position

I want to stop animation after setProgress method call in some position.

Is it possible to make? And how I can achieve this.
Thanks.

Logic error in setIndeterminate: causes "indeterminate" to be NO after setting "indeterminate" to YES twice

The -setIndeterminate: method has a logic error. It should be:

if (indeterminate) {
    if (!self.indeterminate) {
        CABasicAnimation *spinAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
        spinAnimation.byValue = [NSNumber numberWithDouble:indeterminate > 0 ? 2.0f*M_PI : -2.0f*M_PI];
        spinAnimation.duration = self.indeterminateDuration;
        spinAnimation.repeatCount = HUGE_VALF;
        [self.layer addAnimation:spinAnimation forKey:@"indeterminateAnimation"];
    }
 } else {
    [self.layer removeAnimationForKey:@"indeterminateAnimation"];
}

With the existing implementation, if indeterminate is YES, setting the property to YES again has the effect of removing the animation because indeterminate && !self.indetermine evaluates to NO.

(Sorry this isn't coming as a pull request with the fix... really pressed for time at the moment.)

thicknessRatio under default value

if you set de thicknessRatio under 0.3, as set in initialize method:

  • (void) initialize
    {
    if (self == [DACircularProgressView class]) {
    DACircularProgressView *circularProgressViewAppearance = [DACircularProgressView appearance];
    [circularProgressViewAppearance setTrackTintColor:[[UIColor whiteColor] colorWithAlphaComponent:0.3f]];
    [circularProgressViewAppearance setProgressTintColor:[UIColor whiteColor]];
    [circularProgressViewAppearance setInnerTintColor:nil];
    [circularProgressViewAppearance setBackgroundColor:[UIColor clearColor]];
    [circularProgressViewAppearance setThicknessRatio:0.3f];
    [circularProgressViewAppearance setRoundedCorners:NO];
    [circularProgressViewAppearance setClockwiseProgress:YES];

    [circularProgressViewAppearance setIndeterminateDuration:2.0f];
    [circularProgressViewAppearance setIndeterminate:NO];
    

    }
    }

The thicknessRatio never changes its value.

¿Does anybody know why?

Thanks.

indeterminate does not work in swift

First in swift you have to do something like this:

progressView.indeterminate = 1

When I set that, the progressView stays empty and does nothing.

Progress jumps in 2.3

Animation jumps if animation is not completed yet and we set new progress value.
Even incorrect value can be set, like in mentioned above example:
self.progressView.setProgress(1.0, animated: true)
//....and when I call during animation progress
self.progressView.setProgress(0.5, animated: false)
last call initiates remove of animation. And it calls animationDidStop delegate method asynchronously, even after proper progress is set. So after 0.5 is set, 1.0 will be set in animationDidStop in a moment

Version 2.2 without animation delegate works fine

How to solve memory leak of this issue?

I have receive memory leak after set thicknessRatio value

_progressView.thicknessRatio = 0.1; <--- this line

and it show memory leak as this function

  • (DACircularProgressLayer *)circularProgressLayer
    {
    return (DACircularProgressLayer *)self.layer;
    }

Please Help... Thank you

Error - Multiple methods named "setIndeterminate:"

Hello

"[appearance setIndeterminate:NO];" in mehtod initialize.
its a error - "Multiple method named 'setIndeterminate' found with mismatched..." if I have a property named indeterminate in my class or third parties class.

solution:
use "[[DACircularProgressView appearance] setIndeterminate:NO];" instead of "[appearance setIndeterminate:NO];" in method initialize

PS:
The code in initialize method seems to have no effect.When the initialize method is called, any instance hasn't been created

Start at 0%

-DACircularProgressView.m

-(float)progress
{
if(!_progress){
_progress = 0.001f;
}
return _progress;
}

this makes it start out with the smallest possible amount of the circle filled in. Oddly just using 0 doesnt work.

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.