Change Background color of button

Discussion in 'iOS Programming' started by rup28aug, Dec 18, 2008.

  1. rup28aug macrumors newbie

    Oct 22, 2008
    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 ?
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    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.

Share This Page