Edge Learning on iOS--stretching pictures

Source: Internet
Author: User

    • Picture Stretching method One:

How IOS 5.0 will be:

1- (void) Viewdidload {2 [Super Viewdidload];3Uiimageview *imageview =[[Uiimageview alloc] init];4Imageview.frame = CGRectMake ( -, -, -, -);5UIImage *image = [UIImage imagenamed:@"Chat_send_press_pic"];6     //IOS5.0 Incoming is the area that needs to be protected, the remainder is selected to be tiled or stretched according to Resizingmode7image = [Image Resizableimagewithcapinsets:uiedgeinsetsmake ( -, -, -, -) Resizingmode:uiimageresizingmodetile];8     9Imageview.image =image;Ten [Self.view Addsubview:imageview]; One}
    • Picture Stretching method Two:

The most primitive method is also very reliable.

1- (void) Viewdidload {2 [Super Viewdidload];3Uiimageview *imageview =[[Uiimageview alloc] init];4Imageview.frame = CGRectMake ( -, -, -, -);5UIImage *image = [UIImage imagenamed:@"Chat_send_press_pic"];6     //IOS5.0 Incoming is the area that needs to be protected, the remainder is selected to be tiled or stretched according to Resizingmode7image = [Image Resizableimagewithcapinsets:uiedgeinsetsmake ( -, -, -, -) Resizingmode:uiimageresizingmodetile];8     9     //the earliest methodTen     //The image width and height dimensions are generally passed in, and the system extracts the 1*1 area in the middle of the picture to stretch the fill picture . One     //You can add a uiimage classification by encapsulating simplified Code Aimage = [Image StretchableImageWithLeftCapWidth:image.size.width *0.5TopCapHeight:image.size.height *0.5]; -      -Imageview.image =image; the[Self.view Addsubview:imageview];

To simplify the classification created by the code

    • Picture Stretching method Three:

Through, the implementation method:

The code does not change:

1- (void) Viewdidload {2 [Super Viewdidload];3Uiimageview *imageview =[[Uiimageview alloc] init];4Imageview.image = [UIImage imagenamed:@"Chat_send_press_pic"];5Imageview.frame = CGRectMake ( -, -, -, -);6 [Self.view Addsubview:imageview];7}

Edge Learning on iOS--stretching pictures

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.