uiimage-tensile problems

Source: Internet
Author: User

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

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.