How to set cornerRadius for only top-left and top-right corner of a UIView?

Is there a way to set cornerRadius for only top-left and top-right corner of a UIView? I tried the following, but it end up not seeing the view anymore. UIView *view = [[UIView alloc] initWithFrame:frame]; CALayer *layer = [CALayer layer]; UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRoundedRect:frame byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight) cornerRadii:CGSizeMake(3.0, 3.0)]; layer.shadowPath = shadowPath.CGPath; view.layer.mask = layer; 30 … Read more