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

renaming files in a directory using python or R -

html - outline-style different in chrome compared to firefox and internet explorer -

ruby on rails - Carrierwave Timeout -