In Xcode, how do you set the background of a UIButton as an image? Or, how can you set a background gradient in the UIButton?
You can set an background image without any code!
Just press the button you want an image to in Main.storyboard, then, in the utilities bar to the right, press the attributes inspector and set the background to the image you want! Make sure you have the picture you want in the supporting files to the left.