In iOS development, you will encounter a view with a bubble type to do the background, sometimes uiview and Uiimageview, sometimes a dialog button,
If the bubble picture is set directly, the picture will also pull up the small mouth of the bubble in the stretching process, and if it is a button, the content may be added to the small mouth place,
After iOS6, using the resizableimagewithcapinsets refactoring picture size stretch setting can solve this problem.
The principle is that the middle part of the uiimage, no small mouth of a part of the pull out to stretch, and the small mouth part of the same, if it is a button, you need to set the content
The margin on the UIButton this content view.
UIImage * backimage;
Backimage = [UIImage imagenamed:@ "Chatfrom_bg_normal.png"];
Backimage = [Backimage resizableimagewithcapinsets:uiedgeinsetsmake (35, 22, 10, 10)];
Backimageview.image = Backimage;
Backimageview.frame = CGRectMake (,,,);
If UIImage is set for UIButton, it needs to be written as well.
Button.contentedgeinsets = Uiedgeinsetsmake (Kcontenttop, Kcontentleft, Kcontentbottom, kContentRight); These four parameters are the contents of the button for the margin of the view, adjust the value to see the effect.