UIButton
btn.frame = CGRectMake(0,0, 80, 40);
[btn.layersetMasksToBounds:YES];
[btn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径
[btn.layersetBorderWidth:5.0];
CGColorSpaceRef colorSpace =CGColorSpaceCreateDevice
CGColorRef colorref =CGColorCreate(colorSpace,(CGFloat[]){1, 0, 0, 1});
[btn.layersetBorderColor:colorref];//边框颜色
[self.viewaddSubview:btn];
还可以设置CALayer的其它属性,详情查看CALayer帮助文档