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

你的小可爱已上线

如图所示.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走吧!记得帮我点点❤ 爱你哟!

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 聚合函数count : 计算表中的记录数(行数)sum: 计算表中数值列的数据总计值avg: 计算表中数值列的数据...
    Yix1a阅读 477评论 0 0
  • 清江曲.漓江踏歌 徐 宏 漓江雾雨情韵涵,神象报恩桂林殇。龙脊梯,瑶寨秀,一峰独...
    sunxuhong阅读 315评论 0 1