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