Wednesday, June 11, 2014

Rounded Corners in UIView


    UIView *aView  =   /* Some View */

    CGRect bounds = aView.bounds;
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bounds
                                                   byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight)
                                                         cornerRadii:CGSizeMake(10.0, 10.0)];
   
    CAShapeLayer *maskLayer = [CAShapeLayer layer];
    maskLayer.frame = bounds;
    maskLayer.path = maskPath.CGPath;
   
    aView.layer.mask = maskLayer;





No comments: