1. Use Cases
UI sister gave us the size of the picture is fixed, but the requirements will change in the future, if this picture needs a method, there will be jagged effect, then we need to find the UI sister from making a picture, then we can give the image processing is OK----> set up the Image protection area
- (void) viewdidload {[Super viewdidload]; //Create a UIImage object from a picture name (the way the picture is created, is stretched very ugly)UIImage *image = [UIImage imagenamed:@"Chat_send_nor"]; //call a method from the image object to return a stretched picture//Pass in the area you want to protectThis is the biggest protection area.Uiedgeinsets insets =Uiedgeinsetsmake (image.size.height * 0.5, Image.size.width * 0.5, Image.size.height * 0.5-1, Image.size.width * 0.5 -1);
method to invoke //UIImage *resizableimage = [Image resizableimagewithcapinsets:insets]; //uiimageresizingmodetile, tiling, tiling where you need to stretch with unprotected areas//Uiimageresizingmodestretch, stretching, stretching directly to unprotected areas
to set the fill stretch method, you can use this methodUIImage *resizabeleimage =[Image Resizableimagewithcapinsets:insets Resizingmode:uiimageresizingmodestretch]; //set a picture of the background//[self.btn setbackgroundimage:[uiimage resizingimagewithimagename:@ "Chat_send_nor"] forState: UIControlStateNormal]; }
uiimage-tensile problems