Skip to content

Instantly share code, notes, and snippets.

@grevolution
Created April 2, 2014 04:15
Show Gist options
  • Save grevolution/9927836 to your computer and use it in GitHub Desktop.
Save grevolution/9927836 to your computer and use it in GitHub Desktop.
UIProgressView setTrackImage and setProgressImage broke on iOS 7.1, If you are using simple flat color image for your UIProgressView, you can do this:
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define IS_OR_GREATER_IOS7 SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")
if(IS_OR_GREATER_IOS7) {
//specify your track color here
[[UIProgressView appearance] setTrackTintColor:[UIcolor redColor]];
//specify your progress track color here.
[[UIProgressView appearance] setProgressTintColor:COLOR_2D2D2D];
} else {
//keep your old logic here.
[[UIProgressView appearance] setTrackImage:[UIImage imageNamed:@"img_timeline"]];
[[UIProgressView appearance] setProgressImage:[UIImage imageNamed:@"img_timeline_highlight"]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment