I have a couple UIButtons, and in IB they're set to Aspect Fit, but for some reason they're always stretching. Is there something else you have to set? I tried all the different view modes and none of them work, they all stretch.
The solution is to set the contentMode on the imageView property of the UIButton. The UIButton has to be created with custom type for this to work I believe (otherwise nil is returned for this property).
This method worked for me very well.:
In Xib select the button and set user defined runtime attributes:
self.imageView.contentMode Number 1 
We use number because you cant use enum there. But the UIViewContentModeScaleAspectFit is equal to 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With