yannickl/YLProgressBar

Draws outside of bounds at low end

Closed this issue · 2 comments

The bar and stripes are drawn outside of the track at low values. This is due to the fact that the clipping region in those functions is defined as a rounded rect with the same parameters as the track, but the rectangle being drawn is much smaller, leading to a much less convex path. This is most visible in longer progress bars; in shorter ones it grows past this error quickly.

The solution is to clip by the larger path as well:

    UIBezierPath *roundedRect   = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) cornerRadius:self.cornerRadius];
    [roundedRect addClip];

Thank you,

I just added the modifications and it works well, thank you. 👍

Thank you for sharing your code!

Sent from my iPhone

On Jul 19, 2013, at 1:27, Yannick Loriot notifications@github.com wrote:

Thank you,

I just added the modifications and it works well, thank you.


Reply to this email directly or view it on GitHub.