ios - UIButton background height does not wrap text (title) - Swift -


the height of uibutton background (white in picture below) not wrap text (the title). try set inset (content), not work. doing wrong?

enter image description here

try set background image resizable image:

uiimage *image = [uiimage imagenamed:@"somebackgroundimage"]; image = [image resizableimagewithcapinsets:uiedgeinsetsmake(image.size.height / 2, image.size.width / 2, image.size.height / 2, image.size.width / 2) resizingmode:uiimageresizingmodestretch]; [self setbackgroundimage:image forstate:uicontrolstatenormal]; 

swift:

var image = uiimage(named: "someimagename")!; image = image.resizableimagewithcapinsets(uiedgeinsetsmake(image.size.height / 2.0, image.size.width / 2.0, image.size.height / 2.0, image.size.width / 2.0), resizingmode: .stretch) button.setbackgroundimage(image, forstate: .normal) 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -