ios 按钮左面是半圆 右面是直角

你的小可爱已上线

ios 按钮左面是半圆 右面是直角_第1张图片
如图所示.png
 UIButton * maBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 110, (260*W-30)/2, 110, 30)];
        maBtn.backgroundColor = BaseColor;
        [bg addSubview:maBtn];
        
        //TODO:uiview 单边圆角或者单边框
        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:maBtn.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerBottomLeft) cornerRadii:CGSizeMake(maBtn.frame.size.height/2,maBtn.frame.size.height/2)];//圆角大小
        CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
        maskLayer.frame = maBtn.bounds;
        maskLayer.path = maskPath.CGPath;
        maBtn.layer.mask = maskLayer;

需要的人可以直接copy走吧!记得帮我点点❤ 爱你哟!

你可能感兴趣的:(ios 按钮左面是半圆 右面是直角)