当前位置:首页 > 移动开发 > 正文

ios中设置UIButton圆角,添加边框

2024-03-31 移动开发


//例如: UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(50,50,100,40); button.backgroundColor = [UIColor blueColor];
//关键语句 button.layer.cornerRadius = 2.0;//2.0是圆角的弧度,根据需求自己更改 button.layer.borderColor = [UIColor blackColor];//设置边框颜色 button.layer.borderWidth = 1.0f;//设置边框颜色

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/yidong/18646.html