iOS development Project-07 picture stretching

Source: Internet
Author: User

iOS development Project-07 picture stretching

A simple explanation

1. Code Description:

Image processing Code:

1 + (UIImage *) Resizedimage: (NSString *) name2{3     UIImage *image = [UIImage imagewithname:name]; 4     return 0.5 0.5 ]; 5 }6// with half the length and half of the height to the center for stretching. 

Call Extrude (1)

1 /**2 * Click on title Click3  */4- (void) Titleclick: (UIButton *) Titlebutton5 {6     //Change arrow up7[Titlebutton setimage:[uiimage Imagewithname:@"navigationbar_arrow_up"] forstate:uicontrolstatenormal];8     9     Ten     //pop-up menu OneUIButton *button =[UIButton Buttonwithtype:uibuttontypecontactadd]; AButton.backgroundcolor =[Uicolor Bluecolor]; -      -      theHmpopmenu *menu =[[Hmpopmenu alloc] initwithcontentview:nil]; -Menu.Delegate=Self ; -Menu.arrowposition =Hmpopmenuarrowpositioncenter; -     //menu.dimbackground = YES; +[Menu Showinrect:cgrectmake (0,0, -, $)]; -}

Effect:

2. Pop-up menu problems: When the width is greater than 217, there will be a problem.

Code:

1 /**2 * Click on title Click3  */4- (void) Titleclick: (UIButton *) Titlebutton5 {6     //Change arrow up7[Titlebutton setimage:[uiimage Imagewithname:@"navigationbar_arrow_up"] forstate:uicontrolstatenormal];8     9     //pop-up menuTenUIButton *button =[UIButton Buttonwithtype:uibuttontypecontactadd]; OneButton.backgroundcolor =[Uicolor Bluecolor]; A      -Hmpopmenu *menu =[[Hmpopmenu alloc] initwithcontentview:nil]; -Menu.Delegate=Self ; theMenu.arrowposition =Hmpopmenuarrowpositioncenter; -     //menu.dimbackground = YES; -[Menu Showinrect:cgrectmake (0,0, -, $)]; -}

Implementation results:

Cause of the problem: the way the picture is stretched is not correct. Stretching allows the implementation of the arrows to have problems, you can try a different way of stretching.

The previous stretch is stretched to the middle 50%, and the right part of the stretch is not a complete solution to the problem.

Description : Sina official in the face of this problem, the artist set the menu picture is very large, for 434, so if the range of stretching within 217, then there will be no impact. (Adjust the width of the cgrectmake), when you do have a small arrow on the top of the picture, the width of the picture to do a bit.

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.