IOS: Picture stretching without distortion tips

Source: Internet
Author: User

Method:

Suppose the picture is 60*24

CGFloat top = image.height*0.5-1; Top cover Height  cgfloat bottom = top,//Bottom cover height  cgfloat left = image.weight*0.5-1,//left cover width  cgfloat right = left; Right end cover width  uiedgeinsets insets = Uiedgeinsetsmake (top, left, bottom);  Specified as stretch mode, re-assigned after scaling  

Picture height-top cover height-bottom cover height = part of the picture to be stretched. Height

Picture width-Left cover width-right end cover width = Part of the picture to be stretched. Width

To stretch the picture, stretch the middle of the 2*2 so that the picture does not deform

The Uiimageresizingmode parameter that specifies the pattern for the extrusion:

  • Uiimageresizingmodestretch: Stretch mode to fill a picture by stretching the rectangular area specified by the Uiedgeinsets
  • Uiimageresizingmodetile: Tile mode, fills the picture by repeating the uiedgeinsets specified rectangular area

IOS: Picture stretching without distortion 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.