I am trying to fix a cool looking button but for some reason it is looking really weird in the storyboard. Anybody knows why?
That is how it looks when i use the picture i have as the background
And this is how it looks when i set the picture i have as image.
This is the image that i am using for the button:
So my question is basically is there anyway to use this image to fill out the whole button area so it looks good?
When i used andres code:
i guess you have to set this up in code like this:
let insets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10) let image = UIImage(named: "bt_bg")?.resizableImageWithCapInsets(insets) button.setBackgroundImage(image, forState: .Normal)
the insets specify which parts of the image to preserve (in this case 10 points to preserve the rounded corners on the left and right side of the image) and which to repeat (everything within 10 points from the left and the right).
hope it helps.