IPhone:How to remove button background image programmatically


Programmatically I am creating buttons and keeping some background image using setBackgroundImage. I want to remove the set background image in the button after some time interval. I have timer code, which will call after particular interval. At this time, i want to remove the button background image in my program. I'm done with timer code and all. I don't know how to remove button background image programmatically. How to do that removing background image from buttons? Is it possible to remove the already set background image for buttons? Can i make it null as setBackgroundImage again? I can't put white color back for button so as to like removing, because my application screen has some other color design.

Appreciate your help on this !


Best Solution

Just use [button setBackgroundImage:nil forState:UIControlStateNormal]. However, this will give you a pretty much transparent button (except for the button title). Are you trying to hide the entire button? If so, use button.hidden = YES, or button.alpha = 0.0.