views:

355

answers:

2

Hi All,

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 !

thanks.

+1  A: 

You need to hang on to a reference to your button, but as long as you have that, you should be able to call [button setBackgroundImage:nil forState:UIControlStateNormal] from your timer.

Steve Madsen
Done. Thank you.
+1  A: 

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;

Ben Gottlieb