绘图方式切圆角,想切哪个角都行

UIButton * button = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 50, 50)];

    [self.view addSubview:button];

    

    CAShapeLayer * shapeLayer = [CAShapeLayer layer];

    shapeLayer.frame = self.textButton.bounds;

    UIBezierPath * drawPath = [UIBezierPath bezierPathWithRoundedRect:self.textButton.bounds byRoundingCorners:(UIRectCornerBottomRight|UIRectCornerBottomLeft|UIRectCornerTopRight) cornerRadii:CGSizeMake(25.0, 25.0)];

    shapeLayer.path = drawPath.CGPath;

    //shapeLayer.masksToBounds = YES;

    button.layer.mask = shapeLayer;

原文地址:https://www.cnblogs.com/block123/p/5680704.html