alexiscreuzot / KAProgressLabel

Minimal circular progress label
Other
410 stars 73 forks source link

Default roundedCornerWidth doesn't match progressWidth = 4 #15

Closed blixt closed 8 years ago

blixt commented 9 years ago

This configuration worked in v2.1.

screen shot 2015-03-19 at 4 50 46 pm

Here's how I set it up:

KAProgressLabel *uploadProgress = [[KAProgressLabel alloc] initWithFrame:CGRectMake(0, 0, 26, 26)];
uploadProgress.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
uploadProgress.center = CGPointMake(self.contentView.bounds.size.width - 36, self.contentView.center.y);
uploadProgress.hidden = YES;
uploadProgress.progressWidth = 4;
uploadProgress.trackColor = [UIColor colorForRogerProgressBackground];
uploadProgress.trackWidth = 6;
[self.contentView addSubview:uploadProgress];
self.uploadProgress = uploadProgress;
blixt commented 9 years ago

Trying to use uploadProgress.roundedCornersWidth = 3; (and 4) doesn't change the appearance at all, while using uploadProgress.roundedCornersWidth = 2; results in the rounded corners disappearing altogether:

screen shot 2015-03-19 at 5 22 36 pm

alexiscreuzot commented 9 years ago

This is odd. Did you try explicitly setting uploadProgress.roundedCorners = YES;?

blixt commented 9 years ago

@kirualex Specifying roundedCorners = YES doesn't change anything (which I guess is because it's the default?) and setting them to NO gives the expected appearance (like the second screenshot above).

alexiscreuzot commented 9 years ago

hmmm, could you try with the dev branch? I think there may be a bug on the 3.0 here... I'll try to patch this up tomorrow.

alexiscreuzot commented 9 years ago

I pushed a rather big refactoring : pod 'KAProgressLabel' => '3.1'

Let me know if you have issues with it, the adaptations should be straightforward. I may not be finished with refactoring, but this is a good start.

blixt commented 9 years ago

I tried out v3.1 and now the progress bars don't have rounded ends by default (like you said). If I set the roundedCornersWidth property to 4, I get this: screen shot 2015-03-20 at 2 50 39 pm

Here's the setup code:

KAProgressLabel *uploadProgress = [[KAProgressLabel alloc] initWithFrame:CGRectMake(0, 0, 26, 26)];
uploadProgress.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
uploadProgress.center = CGPointMake(self.contentView.bounds.size.width - 36, self.contentView.center.y);
uploadProgress.hidden = YES;
uploadProgress.progressWidth = 4;
uploadProgress.roundedCornersWidth = 4;
uploadProgress.trackColor = [UIColor colorForRogerProgressBackground];
uploadProgress.trackWidth = 6;
[self.contentView addSubview:uploadProgress];
self.uploadProgress = uploadProgress;
kosyak commented 9 years ago

Shouldn't -(void)drawRect:(CGRect)rect in KAProgressLabel.m rely on self.bounds instead of rect if it's not planned to redraw only the part of the KAProgressLabel's frame? I've had the same issue and replacing rect with self.bounds there worked for me. Unfortunately, couldn't pull together a demo to show this kind of behaviour.

alexiscreuzot commented 9 years ago

@kosyak I don't really understand where the problem is with relying on the rect parameter. Could you provide some more details on this in a dedicated issue? (I'm closing this one)

blixt commented 9 years ago

@kirualex Why close this one? The bug still persists (see my last post, the circles are outside the progress bar). Is there another issue tracking this bug?

alexiscreuzot commented 9 years ago

My bad I thought it was, reopening

alexiscreuzot commented 9 years ago

After some fiddling I'm scratching my head on this one, I'll have a look next week.

hobbesthetige commented 9 years ago

I am also having this problem.

progressView.trackWidth = 6.0 progressView.progressWidth = 6.0 progressView.roundedCornersWidth = 5.0

screenshot 2015-08-18 10 55 27

tikhop commented 9 years ago

@kirualex, @hobbesthetige I've come across the same issue and the easiest way to resolve the problem is just subclass UIView instead of UILabel.

kosyak commented 8 years ago

Way too late to report, but in my case, https://github.com/kirualex/KAProgressLabel/commit/2cb335ccd57d44ee825902c496e6029874f771f4 resolved this issue 👍