4. Hat, stretching the image API (see effect chart)

Source: Internet
Author: User

UIImage *img=[uiimage imagenamed:@ "Bubbleself.png"];    Img=[img stretchableimagewithleftcapwidth:15 Topcapheight:12];    Uiimageview *imgview=[[uiimageview alloc]initwithimage:img];    [Imgview Setframe:cgrectmake (10, 10, 200, 200)]; [Self. View Addsubview:imgview];

(Nsinteger) Topcapheight This function is an instance function of UIImage, its function is to create a content can be stretched, and the corner does not stretch the picture, need two parameters, the first is the left not stretch the width of the area, the second parameter is not stretched above the height.

The meaning of the parameter is if the parameter specifies 10, 5. So, the picture on the left 10 pixels, the top 5 pixels. Will not be stretched, the X coordinate is 11 and one pixel will be copied horizontally, and a pixel with a Y coordinate of 6 will be copied vertically.

Note: Only one pixel is copied to a certain width. The remaining pixels behind the image are not stretched.

4. Hat, stretching the image API (see)

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.