Reputation: 1173
I'd like to essentially decrease the height of a UIProgressView to create a "thinner" progress bar. I'm not sure if I'm just using CGAffine incorrectly or I need to use a different approach altogether. Here's my code, prog1, prog2, and prog3 are all progress views already defined:
CGFloat sx1 = 1.0f;
CGFloat sy1 = 1.0f;
CGFloat sx2 = 1.0f;
CGFloat sy2 = 0.5f;
CGFloat sx3 = 1.0f;
CGFloat sy3 = 2.0f;
self.prog1.transform = CGAffineTransformMakeScale(sx1, sy1);
self.prog2.transform = CGAffineTransformMakeScale(sx2, sy2);
self.prog3.transform = CGAffineTransformMakeScale(sx3, sy3);
prog1 displays normally as if nothing was done to it. prog2, instead of showing 1 skinny bar, shows two skinny bars, one on top of the other. prog3, instead of showing 1 fat bar, shows the top half of a fat bar, with the bottom cut off. I tried messing with the frame, but that didn't seem to work too much either.
I noticed that sometimes when testing, it would do this immediately. But sometimes, I would get my desired result. However, after rotating the device, the progress views would always get stuck in the "bad" positions.
Upvotes: 0
Views: 294
Reputation: 130
It appears that this method for displaying a progress bar that's thinner is indeed invalid, my experiments have led me to the same conclusion. There are some third party implementations of progress bars available, some appear to be more popular, namely KOAProgressBar and DDProgressView, but none of which seems to enable really small progress bars.
I Ended up implementing my own 'progress view' that's just a rectangle with two types of fills (needed it for a thin progress line under an internal browser's address bar, similar to the loading indicator at the new YouTube webapp or the chrome browser iOS app). Once i'm done i'll make sure to publish it here.
Upvotes: 1