1. 程式人生 > >設置按鈕單邊邊框

設置按鈕單邊邊框

cti nds dds eight layer mas clas calayer radius

[_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];

設置按鈕單邊邊框