Images for Round Rect

Discussion in 'iOS Programming' started by bytezone, May 14, 2009.

  1. bytezone macrumors member

    Apr 20, 2009
    I am trying to put an image dynamicaly to a round rec button. But once I apply the image , the button does not appear as a round rect instead takes the look of square/rectangle.

    1. How can I make the round rect btn look like round rect after adding iamge..??

    2. Also I would like to display text after adding the image to can I do this....??

    3. How to make the button look gradient color....right now I am using a gradient image over btn to make it look like gradient. Any other options..??

    Thanks in advance for help....
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    1. You can't.
    2. The UICatalog sample app show you how to do this.
    3. With a gradient image. See answer for #2.
  3. kainjow Moderator emeritus


    Jun 15, 2000
    For #1 you'd have to clip the image to the rounded rect, which is most likely just an image. You could do this by subclassing the button and setting the clip in the drawRect method, or clip the image before setting it as the image. This will be of help.

Share This Page