Problem Description:
Progress image and track image are not working properly with Uiprogressview set in storyboard. See a solution that users share, here and need to share my experience with the users. If Daniel has a better way, look forward to the enlighten.
Image:
Progress Image:
Track Image:
Set the effect after success:
Usage Environment:
Ide:xcode 6.3
Language: Object-c
Interface: Storyboard ( I am a Storyboard in the interface, if the code to draw the interface, refer to the Uiprogressview use method )
Workaround:
Use an open source Jeprogressview (Https://gist.github.com/JohnEstropia)
1. Add the Jeprogressview to the project.
2. Drag a Uiprogressview component into the interface in the storyboard.
3. Select the Uiprogressview component and associate the Jeprogressview in the identity inspector on the right.
4. Adjust the code in the corresponding Viewcontroller.
Key code:
uiimage *progressimage = [uiimage imagenamed:@ "Progress_image"]; uiimage *trackimage = [uiimage imagenamed:@ "Track_image"]; //don't let the picture stretch CGFloat top = 10; // top cover height CGFloat bottom = 10 ; // Bottom Cover Height cgfloat left = 20; // Left cover width cgfloat right = 20; / / right End cover width uiedgeinsets insets = uiedgeinsetsmake (top, left, bottom, right); // is specified as stretch mode and is re-assigned after scaling progressimage = [progressimage resizableimagewithcapinsets:insets resizingmode: uiimageresizingmodestretch]; trackimage = [trackimage Resizableimagewithcapinsets:insets resizingmode:uiimageresizingmodestretch]; _musicprogressview.trackimage = trackimage; _musicprogressview.progressimage = progressimage;
Uiprogressview using pictures to set progress image and track image