IOS Picture Stretching tips

Source: Internet
Author: User

For some icons and other buttons under the art Design button can be stretched effect to deal with the desired effect, the most familiar than the oval background chat, but also through this principle of background image.

How do I stretch the picture? First find the part to be stretched, it is obvious that the two sides of the ellipse is constant to stretch is the middle section, how to specify the middle part, first look at

Specifying these 4 widths will result in a black module. This is the piece of content that is constantly filling the middle of the stretch.

Specific code:

1uiimage* img=[uiimage imagenamed:@"2.png"];//Original2Uiedgeinsets Edge=uiedgeinsetsmake (0,Ten,0,Ten);3     //Uiimageresizingmodestretch: Stretch mode to fill a picture by stretching the rectangular area specified by the Uiedgeinsets4     //Uiimageresizingmodetile: Tile mode, fills the map by repeating the uiedgeinsets specified rectangular area5img=[img Resizableimagewithcapinsets:edge resizingmode:uiimageresizingmodestretch];6self.imageview.image=img;

Post-stretch effect:

IOS Picture Stretching tips

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.