- (UIButton *)addButton {
if (!_addButton) {
self.addButton = [UIButton buttonWithType:UIButtonTypeCustom];
_addButton.frame = CGRectMake(maxX(self.contentTextFiled), minY(self.contentTextFiled), BUTTONWIDTH*KScDefineWidth, BUTTONWIDTH*KScDefineWidth);
//TODO:uiview 单边圆角或者单边框
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_addButton.bounds byRoundingCorners:(UIRectCornerTopRight | UIRectCornerBottomRight) cornerRadii:CGSizeMake(5,5)];//圆角大小
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = _addButton.bounds;
maskLayer.path = maskPath.CGPath;
_addButton.layer.mask = maskLayer;
[_addButton setBackgroundImage:[UIImage imageNamed:@"img_add_black"] forState:UIControlStateNormal];
[_addButton addTarget:self action:@selector(addNumAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _addButton;
}
转载于:https://my.oschina.net/u/2481202/blog/670131