Button Background Image Alpha

Discussion in 'iOS Programming' started by hotkarl, Dec 2, 2010.

  1. hotkarl macrumors newbie

    hotkarl

    Joined:
    Nov 19, 2010
    Location:
    Northern Utah
    #1
    Can I change the alpha of just the button's background image? If I change the button's alpha [button setAlpha: 0.2] the text's alpha changes as well and I'd like the text to stay bright white. Any way?
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Don't think so directly. You could create a new blank image and draw the existing image into with a given alpha value, then set that as the button's image.
     
  3. hotkarl, Dec 2, 2010
    Last edited by a moderator: Dec 2, 2010

    hotkarl thread starter macrumors newbie

    hotkarl

    Joined:
    Nov 19, 2010
    Location:
    Northern Utah
    #3
    Dig. Thank you for your reply.

    But when I click a button it looks like the background alpha changes while the text changes color over top.

    adjustsImageWhenHighlighted
    A Boolean value that determines whether the image changes when the button is highlighted.

    @property(nonatomic) BOOL adjustsImageWhenHighlighted
    Discussion
    If YES, the image is drawn lighter when the button is highlighted. The default value is YES.

    Availability
    Available in iOS 2.0 and later.


    Isn't there a way to do that to the image?
     

Share This Page