IOS 圆形头像 UIButton边框 按钮边框

m

UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];

btn.frame = CGRectMake(0, 0, 80, 40);

[btn.layer setMasksToBounds:YES];

[btn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径

[btn.layer setBorderWidth:5.0];   //边框宽度

CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 1, 0, 0, 1 }); 

[btn.layer setBorderColor:colorref];//边框颜色

[self.view addSubview:btn];


你可能感兴趣的:(IOS 圆形头像 UIButton边框 按钮边框)