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.