Stretchableimagewithleftcapwidth: topcapheight: function usage Summary

Source: Internet
Author: User

1.-(uiimage *) stretchableimagewithleftcapwidth :( nsinteger) leftcapwidth topcapheight :( nsinteger) topcapheight

This function is an instance function of uiimage. Its function is to create an image whose content can be stretched but its corners are not stretched. Two parameters are required, the first parameter is the width of the area and left border without stretching, and the second parameter is the width of the area and top border without stretching.

When I used this function for the first time, I never understood why I only needed two parameters. I should specify at least the upper left corner and the lower right corner. There are four parameters in total. Later, I read the document to understand that only two parameters are required.

The meaning of the parameter is that if the parameter is set to 10, 5. Then, 10 pixels on the left and 5 pixels on the top of the image. It will not be stretched. If the X coordinate is 11 and a pixel is copied horizontally, a pixel with the Y coordinate is copied vertically. Note: Only copy a pixel to a certain width.

Appendix: bubbles used for two chats, and parameter values.

15,13

21, 13

2.-(uiimage *) stretchableimagewithleftcapwidth :( nsinteger) leftcapwidth topcapheight :( nsinteger) topcapheight

This function is an instance function of uiimage. Its function is to create an image whose content can be stretched but its corners are not stretched. Two parameters are required, the first parameter is the width of the area and left border without stretching, and the second parameter is the width of the area and top border without stretching.

Example: (source image)

Adjusted chart:
Code:
Float capwidth = 100366f; float topcapwidth = 100366f;

Basegreen = [[uiimage imagenamed: @ "green.png"]Stretchableimagewithleftcapwidth: Capwidth topcapheight: topcapwidth] retain];

3. stretchableimagewithleftcapwidth: topcapheight: Creates and returns an object with a new image with a specified maximum value.

-(Uiimage *) stretchableimagewithleftcapwidth :( nsinteger) leftcapwidth topcapheight :( nsinteger) topcapheight

Parameters
Leftcapwidth
The maximum value to be used is the width on the left. Specify 0 if you do not want the image to be horizontally stretched. Discuss how values will affect the image and see the leftcapwidth property.

Topcapheight
The value to be used is the width of the top cover. Specify 0 if you do not want the image to be vertically stretched. Discuss how values will affect the image and see the topcapheight property.

Return Value
Objects with a new image with a specified value limit.

Discussion
In scaling or image size, the upper limit of the scope covered is not scaling or resizing. On the contrary, the one-pixel wide area is scaled or adjusted in each direction on the CAP. This technique is usually used to create a variable-width button with the same rounded corner, but the need to zoom in or out the central area of the button.

This method is used to add an image with a maximum value or change the existing maximum value of the image. In both cases, you get a new image and the original image is still indifferent.

To put it bluntly, it is to process an image and only scale the part to be enlarged in the middle, without stretching the four corners, and with only one side stretching the four sides.

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.