On a UIButton I set background images like this
[twitterButton setBackgroundImage:twitterImage forState:UIControlStateNormal];
twitterImage is of type UIImage
Now somewhere in the code on any button clicked I set twitterButton image using tag value
[twitterButton setBackgroundImage:twitterImage1 forState:UIControlStateNormal];
My problem is How would I compare the image of twitterButton ?
this condition is not working if([twitterbutton.imageView.image isEqual:twitterImage1])
Please help
Try comparing against the UIImage returned by the backgroundImageForState: method instead of the UIButton imageView’s image property…
ie.,
See the UIButton class reference for more information.