Uiprogressview using pictures to set progress image and track image

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.