我用的是Masonry布局.
我想绘制如箭头所示的部分圆角按钮.请问用代码怎么实现?
在哪个方法里面写?
code:
//部分圆角按钮
UIButton *loggedBtn = [[UIButton alloc]init];
loggedBtn.backgroundColor = [UIColor blueColor];
[headView addSubview:loggedBtn];
[loggedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.offset(40);
make.height.offset(20);
make.right.equalTo(headView);
make.centerY.equalTo(headView);
}];
高洛峰2017-04-17 17:36:40
我直接把我代码给你,你看一下应该就知道怎么修改我的代码实现你要的效果啦
- (void)setupCornerRadius
{
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.musicChooseView.bounds
byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
cornerRadii:CGSizeMake(12, 12)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.musicChooseView.bounds;
maskLayer.path = maskPath.CGPath;
self.musicChooseView.layer.mask = maskLayer;
}