Change Background color of button

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

  1. macrumors newbie

    Joined:
    Oct 22, 2008
    #1
    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. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    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