I am trying to set Progress image and Track image for UIProgress view using the designer, preview screen shows me the desired view with track image as the background of the progress bar and Progress image used for progress bar. But when i run my code both the images are not getting used instead progress is displayed using the background color and tint color of the View. Can someone tell me how to override the tint color and background color and use Progress image and Track Image property.
Asked
Active
Viewed 1.1k times
4
-
what's the size of the progress & track images? – Raj Subbiah Nov 28 '13 at 13:12
-
one is 641X116 and other is 604X108 and progress bar is displayed in 320X60, could size be a problem? – akshay202 Nov 28 '13 at 13:16
-
No. I thought your images are too small. Are you testing this in iOS 5 & above right? – Raj Subbiah Nov 28 '13 at 13:24
-
Yes, I am running it on ios 7 device. – akshay202 Nov 28 '13 at 13:26
-
1Try this in code, It's working for me. [progressView setTrackImage:[UIImage imageNamed:@"track"]]; [progressView setProgressImage:[UIImage imageNamed:@"progress"]]; – Raj Subbiah Nov 28 '13 at 13:37
-
Any idea why is it not working through the property in designer? – akshay202 Nov 28 '13 at 13:48
-
That Might be a bug in xcode :-) – Raj Subbiah Nov 28 '13 at 14:18
-
You might want to move your solution to the answer section. – akshay202 Nov 28 '13 at 14:21
-
Solution added @akshay202 :-) – Raj Subbiah Nov 28 '13 at 14:25
2 Answers
8
Try this following code in programmatically,
[progressView setTrackImage:[UIImage imageNamed:@"track"]];
[progressView setProgressImage:[UIImage imageNamed:@"progress"]];

Raj Subbiah
- 1,292
- 11
- 20
1
A simple solution to override UIProgressView's tint color :
progressVw.trackTintColor = [UIColor whiteColor];
If you want to set backColor of UIProgressView-
Use this Custom UIProgessView
If you want to set Progress image and Track Image of UIProgressView-
Refer this link Progress image and Track Image
-
I dont want to use tintcolor at all, I want to use images. How to I tell it to not use tint color and use Progress image and Track image instead. – akshay202 Nov 28 '13 at 13:21