border in view

Discussion in 'iOS Programming' started by chhoda, Dec 2, 2008.

  1. macrumors 6502

    Oct 25, 2008
    Hi All,
    I need to show rounded rectangle borders in my views, but i could not find a way !

  2. macrumors newbie

    May 6, 2009
    place a uiimageview in you view and put a transparent bordered png image on imageview.
  3. macrumors 6502

    Oct 31, 2007
    San José
    Since every UIView is backed by a Core Animation layer, you can work directly on the layer if you want.

    If you are building for 3.0 or higher, you have access to CALayer properties like cornerRadius, borderWidth, and borderColor. Those three should do exactly what you are looking for.
  4. Moderator emeritus


    Jun 15, 2000
    Don't use an image unless you have a very complicated design. If you can, just use the layer properties or override drawRect.

    My biggest pet peeve is when developers use bitmap images for their UI when it could be drawn in code.

Share This Page