美文网首页
iOS设置view的圆角

iOS设置view的圆角

作者: 白牛桑 | 来源:发表于2016-01-17 15:56 被阅读142次

上图是目标效果;那让我们来实现吧

UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];

button.frame = CGRectMake(100, 200, 100, 50);

button.backgroundColor = RGBCOLOR(163, 135, 91);

[button setTitle:@"进入房间" forState:UIControlStateNormal];

[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

[button.layer setMasksToBounds:YES];

[button.layer setCornerRadius:button.height / 2];// 圆角角度

[button.layer setBorderWidth:1.0];// 圆角宽度

[button.layer setBorderColor:[UIColor clearColor].CGColor];// 圆角颜色

[self.view addSubview:button];

完成。(UILabel,UIImageView同理)

相关文章

网友评论

      本文标题:iOS设置view的圆角

      本文链接:https://www.haomeiwen.com/subject/euikhttx.html