PDA

View Full Version : UIView With Rounded Corners?




Darkroom
Aug 15, 2009, 11:08 AM
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.



Darkroom
Aug 15, 2009, 12:15 PM
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:


self.myView.layer.cornerRadius = 50;

tylerneylon
May 8, 2010, 08:53 PM
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