问题
I have an app using progress views with custom images. I use the code below:
[cell.proStatus setTrackImage: [[UIImage imageNamed:@"CircleGrey.png"] resizableImageWithCapInsets:UIEdgeInsetsZero]];
[cell.proStatus setProgressImage: [[UIImage imageNamed:@"CirclePurple.png"] resizableImageWithCapInsets:UIEdgeInsetsZero]];
It all works fine in iOS 6 and 7.0 - BUT when updating to iOS 7.1 it doesn't show the images - just the small little thin line (the standard progress view). What do I do?
I have searched and read here in stack overflow of course. And i have found the following:
UIProgressView custom track and progress images in iOS 7.1
But I can't get it to work? I'm a little new to this programming. Can someone please tell me (simple and basics) what i have to do to get it to work? In the thread I linked to the answer is to implement a JEProgressView from github. Maybe I'm just too much a beginner to completely understand how to do that. I have googled and tried, but it just won't work.
回答1:
Okay I have worked it out. I know it must be very basic Xcode stuff - but if there is others who have the same issue as I had, here is what I did.
- Download the JEProgressView files from github. (https://gist.github.com/JohnEstropia/9482567)
- Import them into the project.
- In the storyboard (if you use that) select the current ProgressView, and in the right side of the screen under 'Identity inspector', in the field 'Class' enter : "JEProgressView"
Maybe it is placed a little different on the screen, and you have to adjust a little afterwards in the x and y frame settings. But after these steps it should work!
Pretty simple, but for a beginner like me it took some time to figure out :-P Hopefully this can save some time for other beginners ;-)
回答2:
Try this for iOS version 7.1 and above in customizing progress image:
if ([[UIDevice currentDevice] systemVersion] >= 7)
{
[cell.proStatus setTrackTintColor: [UIColor colorWithPatternImage: [[UIImage imageNamed:@"CircleGrey.png"] resizableImageWithCapInsets:UIEdgeInsetsZero]]];
[cell.proStatus setProgressTintColor: [UIColor colorWithPatternImage: [[UIImage imageNamed:@"CirclePurple.png"] resizableImageWithCapInsets:UIEdgeInsetsZero]]];
}
来源:https://stackoverflow.com/questions/22540200/uiprogressview-custom-images-doesnt-work-in-ios-7-1