button 边框和角的弧度《笔记篇》
2016-07-24 本文已影响56人
失忆的程序员
UIButton *button = [UIButton alloc] initWithFrame:CGRect(100, 100, 100 , 100)];
//设置边框颜色
button.layer.borderColor = [[UIColor redColor] CGColor];
//设置边框宽度
button.layer.borderWidth = 1.0f;
//给按钮设置角的弧度
button.layer.cornerRadius = 4.0f;
xib 中 layer.cornerRadius
//设置背景颜色
button.backgroundColor = [UIColor redColor];
button.layer.masksToBounds = YES;