记录 贝塞尔曲线创建圆角

  UIView *greenView = [[UIView alloc] initWithFrame:CGRectMake(10, 200, 100, 100)];
    greenView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:greenView];
    //添加圆角
    UIBezierPath *cornerPath1 = [UIBezierPath bezierPathWithRoundedRect:greenView.bounds byRoundingCorners:(UIRectCornerTopRight|UIRectCornerBottomLeft|UIRectCornerTopLeft|UIRectCornerBottomRight) cornerRadii:CGSizeMake(5, 5)];
    CAShapeLayer *maskLayer1 = [CAShapeLayer layer];
    maskLayer1.frame = greenView.bounds;
    maskLayer1.path = cornerPath1.CGPath;
    greenView.layer.mask = maskLayer1;

你可能感兴趣的:(记录 贝塞尔曲线创建圆角)