Yes the image get scaled because you are using backgroundImage
(not Image
). Both images have different behaviors.
Check the Xcode Interface Builder, you can see there, that you can set two images: Image and Background. Background is the UIImage
that get scaled for the whole frame of the UIButton
.
The UIButton Class Reference allows you to access the imageView
of the image
(not theimageView
of the backgroundImage
)
Because you have access to the imageView
, you can change the mode of the image with:
[[someButton imageView] setContentMode:UIViewContentModeBottomLeft];
In UIView Class Reference you can check all the UIViewContentModes
provided by Apple.
You can check that changing a little bit your code:
[someButton setImage:firstButtonImage forState:UIControlStateNormal];
[[someButton imageView] setContentMode:UIViewContentModeBottomRight];