Before doing a solid-color local stretch the shadow stretching through top bottom left right intersects
Implementation method:
Imageview.image = [[UIImage imagenamed: @ "Icon_helper_palace_day"] resizableimagewithcapinsets:palaceinset]];
I use this method to stretch a patterned figure of the relative solid color of the part of the time will find that the picture is stretched at the same time there will be a picture of the local itself filled with the phenomenon seems to be continuous with the same 1 half a figure
This time, I'm not taking into account a property of the stretch picture uiimage
:
typedef ns_enum (Nsinteger, Uiimageresizingmode) {
Uiimageresizingmodetile,//进行区域复制模式拉伸 "填充"
uiimageresizingmodestretch,//进行渐变复制模式拉伸 "拉伸"
};
The default property is that the one that is obviously the pixel fill is suitable for a solid fill stretch, so the rest of the stretch should be used with your stretch property.
Implemented as follows:
Imageview.image = [[UIImage imagenamed:@ "Icon_helper_palace_day"] Resizableimagewithcapinsets:palaceinset Resizingmode:uiimageresizingmodestretch];
Really is La Biolu (the background palace stretches the Red wall section)
This is a good deal of local image processing, but the same picture obtained from the network using the same method as follows:
The palace is at the bottom, but it's not visible after stretching. Just this is why I study half a day even myself wrote a demo intended to help netizens, I suddenly found that the online transmission of the picture is xx.png and the local picture is @2x @3x This is the key difference!!!! Description Code Very honest expression of this embarrassing situation , for the network download Xx.png app must default to the original image is "@1x" one times, then I would like to let him as the local image effect must be processed proportionally cut can:
UIImage *iconimage = [Hfimageutil scaletosize:image newsize:[uiimage imagenamed:@ "Icon_helper_palace_day"]. Size]; The size of the application level of the 2x or 3x local graph obtained by the current application is cropped
It's going to stretch out and then it's normal.
IOS UIImage Some Learning essentials for local stretching of pictures