-1

I have blue UIView and I want top corners.
This is my code:

UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.backgroundContentView.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) cornerRadii:CGSizeMake(20.0, 20.0)];
CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init];
shapeLayer.frame = self.backgroundContentView.bounds;
shapeLayer.path  = path.CGPath;
self.backgroundContentView.layer.mask = shapeLayer;

But I have only leftTop corner. Why?

enter image description here

Phiter
  • 14,570
  • 14
  • 50
  • 84

1 Answers1

0

use this code to alloc memory to CALayer

CAShapeLayer *maskLayer = [CAShapeLayer layer];

Syed Qamar Abbas
  • 3,637
  • 1
  • 28
  • 52