#pragma mark - 签到 sigBtn
_sigBtn = [[UIButton alloc] initWithFrame:CGRectMake(HJWIDTH/3*2-14, (90-70)/2+13, HJWIDTH/3, 40)];
[_sigBtn setImage:[UIImage imageNamed:@"积分"] forState:UIControlStateNormal];
[_sigBtn addTarget:self action:@selector(sButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[_sigBtn setBackgroundColor:App_shoukeColor];
// 实现按钮左边半圆
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_sigBtn.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerBottomLeft) cornerRadii:CGSizeMake(_sigBtn.frame.size.height/2,_sigBtn.frame.size.height/2)];//圆角大小
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = _sigBtn.bounds;
maskLayer.path = maskPath.CGPath;
_sigBtn.layer.mask = maskLayer;
[zhuView addSubview:_sigBtn];
效果如下:
屏幕快照 2019-09-26 14.31.51.png
网友评论