Is it possible to have a custom UIButton that has an image covering only half of it? I imagine it would be something like this:
UIButton *someButton = [UIButton buttonWithType:UIButtonTypeCustom];
[someButton setBackgroundImage:[UIImage imageNamed:@"buttonPicture"]];
/* Then there must be some property I can set that prevents the button from stretching the image?? */
.
.
.
I want to have a 50x100px button which only has a 50x50px image on the top half, and to be transparent on the bottom half.
I know how to create a custom button and everything. Im just woondering what the property is that controls the stretching of the backgroundImage.
Thanks!
Use
[someButton setImage:[UIImage imageNamed:@"buttonPicture"] forState: UIControlStateNormal];
someButton.imageEdgeInsets = UIEdgeInsetsMake(-50, 0, 0, 0);
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