This adds rounded corners to just the corners which you want rounded not all of them like the new CALayer cornerRadius
.
Import the category first:
#import UIView+RoundedCorners.h
Use the following to round all corners:
[myView setRoundedCorners:UIRectCornerAllCorners radius:10.0];
For Top Left and Top Right:
[myView setRoundedCorners:UIRectCornerTopLeft|UIRectCornerTopRight radius:10.0];
Here I have used the inbuilt enum UIRectCorner
for specifying the rounded corners. So its much simpler to implement.
iOS 5 only for demo as I am using ARC, but the core UIView category should work with iOS 3.2+