I have a UIButton
in my app, where instead of text I give it an image, as it servers as a thumbnail button that will present the full image upon being tapped.
I saw this answer as seemingly the accepted implementation of this, but with images smaller than the button themselves, the image view doesn't actually fill the button as the contentMode should, or as it would with an image view, as shown below:
As you can see, with the image view it expands properly, but with the button it doesn't. (The button background is set to blue so you can see where it's not showing up.)
The code I'm doing is dead simple:
myButton.setImage(UIImage(named: "pokemon"), forState: .Normal)
myButton.imageView!.contentMode = .ScaleAspectFill
How do I change it so that it fills it properly?
Sample Project: http://cl.ly/0z2T1A1Z3v3m