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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -