Maintaining Aspect Ratio when placing a view in a UIButton?


This is easy in OSX and bindings. But how do I maintain the aspect ratio of an UIImage place in a UIButton… via [myButton setImage…] or [myButton setBackgroundImage…].

In IB, there is a setting for Aspect Ratio in the View settings but it seems to make zero difference.


Did you try modifying the contentMode property of the corresponding UIImageView object?