You need to add a gradient as background color so that the elements that will be added on top are visible. When you try to use the insertSublayer method atIndex: 0, instead of a gradient, you get a shadow over the view. Tell me how to fix this problem.
UIRectCorner corners = UIRectCornerTopRight | UIRectCornerBottomRight; UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.myView.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(150.f, 150.f)]; CAShapeLayer *segment = [CAShapeLayer layer]; segment.fillColor = [UIColor clearColor].CGColor; segment.lineWidth = 1.0; segment.path = path.CGPath; segment.shadowColor = [UIColor blackColor].CGColor; segment.shadowOffset = CGSizeMake(30, 0); segment.shadowOpacity = 0.75; segment.shadowRadius = 3.0; segment.shadowPath = segment.path; [self.myView.layer addSublayer:segment]; CAGradientLayer *gradient = [CAGradientLayer layer]; UIColor *firstColor = [UIColor yellowColor]; UIColor *secondColor = [UIColor lightGrayColor]; gradient.colors = @[(__bridge id)firstColor.CGColor, (__bridge id)secondColor.CGColor]; gradient.frame = CGPathGetBoundingBox(segment.path); CAShapeLayer *mask = [CAShapeLayer layer]; CGAffineTransform translation = CGAffineTransformMakeTranslation(-CGRectGetMinX(gradient.frame), -CGRectGetMinY(gradient.frame)); mask.path = CGPathCreateCopyByTransformingPath(segment.path, &translation); gradient.mask = mask; [self.myView.layer addSublayer:gradient];