Alexander Karaberov Alexander Karaberov - 16 days ago 5
iOS Question

How to change background image of the UIButton in Interface Builder and preserve its shape?

I'm in the process of writing my first

Hello World
application for iOS, and I don't know even elementary things, so I'm sorry if this question will be stupid. I want to change the background image of button. But when I do this button changes its shape and becomes squared instead of
Rect Square
(with non-zero corner radius). So the question are there some ways to change background and preserve button's shape either directly by Interface Builder or by manipulating XML-like language in
.xib
files or whatever other way.

Answer

Add a button and set its type property to custom. With this method you could define an image for the button as you would like it to be displayed not just the background within the rounded rect.

enter image description here