What is the difference between UIButton background and UIButton imageview.view
I tried myButton.imageView.image=[UIImage imageNamed:@"image.png"];
then nothing happens, but when I use [myButton setBackgroundImage:[UIImage imageNamed:@"image.png"] forState:UIControlStateNormal];
button's background changes.
Thanks !
myButton.imageView.image is a readonly property and thus can't be change like this. whereas setBackgroundImage is a method which sets the background properly.
//EDIT
the method setImage for UIButton REQUIRES two arguments,
setImage:(UIImage *) forState:(UIControlState)
thus using the above mentioned method works fine and other doesn't.
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