PDA

View Full Version : Change Background color of button




rup28aug
Dec 18, 2008, 02:53 AM
hi all,
i want to change the background color of button. There are no option to set the background color of button. also whether it is possible to make color as gradient ?



dejo
Dec 18, 2008, 09:57 AM
hi all,
i want to change the background color of button. There are no option to set the background color of button. also whether it is possible to make color as gradient ?
Correct, UIButton does not allow you to set the backgroundColor of the button. You can change the backgroundColor of it's UIView superclass but that's not what you want, since it changes the background color outside of the button. I would think your best bet is to use a background image for your button ( see setBackgroundImage:forState: ). This will also allow you to do the gradient you want.