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

swift - Button on Table View Cell connected to local function -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

c# - ajax - How to receive data both html and json from server? -