It seems there is no way to set the track tint of the UIProgressView.
The Progress Tint works just fine, but the Track Tint only remains a dark gray color.
Any suggestions? Without creating a custom progress view?
Thanks.
It seems there is no way to set the track tint of the UIProgressView.
The Progress Tint works just fine, but the Track Tint only remains a dark gray color.
Any suggestions? Without creating a custom progress view?
Thanks.
The UIProgressView track is actually a UIVisualEffectView with a blur effect and can not be tinted.
Is there any reason for
public var trackTintColor: UIColor?in the UIProgressView class declaration, i.e. is it coming later?
Please file a bug report at https://bugreport.apple.com for features you'd like to see.
I ran into this too. Luckily it's simple to write your own progress view:
-(void) drawRect: (CGRect)rect
{
UIColor *progressColor = <whatever color>;
UIColor *trackColor = <whatever color>;
CGFloat cornerRadius = .5 * rect.size.height;
UIBezierPath *bez = [UIBezierPath bezierPathWithRoundedRect: rect cornerRadius: cornerRadius];
[bez addClip];
[trackColor setFill];
UIRectFill(rect);
[progressColor setFill];
UIRectFill(CGRectMake(0, 0, ceilf(self.progress * rect.size.width), rect.size.height));
}
-(void) setProgress: (CGFloat)progress
{
_progress = progress;
[self setNeedsDisplay];
}
Good solution there! I was hoping we wouldnt have to creat our own, but alas your solution works for me!
Thanks!