UIView With Rounded Corners?

Discussion in 'iOS Programming' started by Darkroom, Aug 15, 2009.

  1. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #1
    just throwing this out there incase it is actually possible, but i'm fairly sure it's not possible to programatically code a UIView with rounded corners? the reason i ask is so that i can clip a view within the rounded corner view during an animation (rounded corner view moves, clipped view is static), while being above other views.
     
  2. Darkroom thread starter Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #2
    humm... apparently layer has a corner radius property in SDK 3.0... unfortunately i can't seem to simply tell my uiview's layer to change it's corner radius like so:

    Code:
    self.myView.layer.cornerRadius = 50;
    
     
  3. tylerneylon macrumors newbie

    Joined:
    May 8, 2010
    #3
    cornerRadius in CALayer

    To get the cornerRadius to work with UIView's backgroundColor, you need to set clipsToBounds = YES. Just in case you might have run into that problem!

    This page has more info on using CALayer properties like that:

    http://bynomial.com/blog/?p=52
     

Share This Page