I am trying to get an image on top of text on a UIButton. I have put the image as the background image on the UIButton and set the VerticalAlignment and the image now does sit above the text :) like this :
button.imageView?.image
button.setBackgroundImage(image, forState: UIControlState.Normal)
button.titleLabel?.font = UIFont(name: "Cantarell", size: 14)
button.setTitle("Test", forState: UIControlState.Normal)
button.contentVerticalAlignment = UIControlContentVerticalAlignment.Bottom
The only problem is that the image now fills the whole button up and it looks rubbish and blocky. I have tried to crop the image with Photoshop and it still fills the button and looks blocky. Can I set the backgroundImage frame size for example in swift ?
So the image ends up like this :
So the image needs to be smaller and its blocky. I have cropped it in Photoshop and it doesn't help. Just makes it more blocky. Is there .frame I can set for the size of the button background image ?