yannickl / YLProgressBar

UIProgressView replacement with an highly and fully customizable animated progress bar in pure Core Graphics
http://yannickloriot.com/library/ios/ylprogressbar/
MIT License
1.28k stars 186 forks source link

Why is the text only shown at 30%? #20

Closed sambudda closed 9 years ago

sambudda commented 9 years ago

I am using this control in my app

If I set it to 10% I don't see the text saying 10% on the bar. It only shows up if it goes above 30%. How can I fix that?

[_progressBarRoundedFat setProgress:0.1f animated:animated];

sambudda commented 9 years ago

Look at these screenshots. My bar is close to 28% and I don't see anything. I only see if it goes above 30% what is going on? ios simulator screen shot jan 19 2015 8 41 07 pm ios simulator screen shot jan 19 2015 8 41 21 pm

yannickl commented 9 years ago

Hi,

This is an expected behaviour because when the track bar is too short there is no way to display the indicator text properly. I can may be decrease the threshold, but the problem will occur for small values.

If you have any suggestion please keep me in touch.

sambudda commented 9 years ago

There is clearly something wrong with the logic here. As you can see there is still plenty of space left on the progress bar and yet it doesn't show 28%. Why do you need a text box that big? I can understand that the bar will be too small between 0 - 10% but after that it can accommodate text. Let me know where in the code I need to tweak and I will play around a bit to get it working and post code solution here.

yannickl commented 9 years ago

Yes I know, this is may be not a good solution. May be it is better to shrink the text until very low values. I'm open to new suggestion. :)

Here is the code: https://github.com/yannickl/YLProgressBar/blob/master/YLProgressBar/YLProgressBar.m#L558

sambudda commented 9 years ago

I just tried uncommenting this code out and it seems promising. What it does is that it keeps the text in the bigger format as long as possible (12 - 100%) for it to fit. For lower values like 0 - 11% it shrinks the text and its box down. It looks a little goofy between 0 - 11 but then the text adjusts its self on the status bar. I recommend this should be made as a option for others to turn on/off. I understand there are times to hard code but 2.5 seems a little big. Maybe 1.0 is better. That too should be user option.

/* if (CGRectGetWidth(innerRect) < CGRectGetHeight(innerRect) * 2.5) { return; } */

yannickl commented 9 years ago

Ok, I'll update/add this option and see what is the most convient for users.

yannickl commented 9 years ago

have you had time to test the changes?

tbechtum commented 9 years ago

Hi Yannick, I did install your latest pod version weeks ago and it worked fine. Tomorrow I will check with pod update if I have the latest version installed. Please tell me if this is not meeting your test plans.

Thanks again for your work! Thomas

Am 02.02.2015 um 18:49 schrieb Yannick Loriot notifications@github.com<mailto:notifications@github.com>:

have you had time to test the changes?

Reply to this email directly or view it on GitHubhttps://github.com/yannickl/YLProgressBar/issues/20#issuecomment-72502488.

tbechtum commented 9 years ago

Hi Yannick,

I had already YLProgressBar (3.5.1) installed and this works fine.

Best regards, Thomas

On 02 Feb 2015, at 20:35, Bechtum Thomas Thomas.Bechtum@unibz.it<mailto:Thomas.Bechtum@unibz.it> wrote:

Hi Yannick, I did install your latest pod version weeks ago and it worked fine. Tomorrow I will check with pod update if I have the latest version installed. Please tell me if this is not meeting your test plans.

Thanks again for your work! Thomas

Am 02.02.2015 um 18:49 schrieb Yannick Loriot notifications@github.com<mailto:notifications@github.com>:

have you had time to test the changes?

— Reply to this email directly or view it on GitHubhttps://github.com/yannickl/YLProgressBar/issues/20#issuecomment-72502488.