How set image in button when ever click the button image show me that button
run.backgroundColor = [UIColor redColor] I try this but it doesn’t work,
How set image in button when ever click the button image show me that
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To set an image for a button while it is currently being touched (I think this is what you’re asking). You use setImage: forState on the UIButton.
[myButton setImage:[UIImage imageNamed:@"myButtonGraphic.png"] forState:UIControlStateHighlighted];You can control when the image appears using the different control states, one of:
UIControlStateNormal
UIControlStateHighlighted
UIControlStateDisabled
UIControlStateSelected
UIControlStateApplication
UIControlStateReserved
If you use UIControlStateNormal, the image is displayed all the time, and when the button is currently being touched it will appear dimmer which for a lot of cases is good enough to indicate to the user that they are selecting that button and that it’s a real touchable ‘thing’.