iOS开发_设置按钮单边边框

[_btn1.layersetMasksToBounds:YES];
// 设置矩圆角半径
[_btn1.layersetCornerRadius:3.0]; 
// 边框宽度
[_btn1.layersetBorderWidth:1.0];  
// 单边边框(右边)
CALayer *deleteBtnBorder = [CALayer layer];
float height = self.deleteBtn.height;
float width = self.deleteBtn.width;

deleteBtnBorder.frame = CGRectMake(width, 0, 1, height);
deleteBtnBorder.backgroundColor = [UIColor redColor].CGColor;

[self.deleteBtn.layer addSublayer:deleteBtnBorder];
posted @ 2019-02-15 22:34  CH520  阅读(293)  评论(0编辑  收藏  举报