UIView(边框和弧度)

作者: guaker | 来源:发表于2015-03-02 19:09 被阅读846次
边框弧度
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 200)];
view.backgroundColor = [UIColor grayColor];
//取出view的层
CALayer *layer = [view layer];
//设置层的弧度是10
layer.cornerRadius = 10;
//剪切掉多余的阴影
layer.masksToBounds = YES;
//设置层的边框的宽度为3
layer.borderWidth = 3;
//设置层的边框的颜色为红色,颜色转换成CGColor
layer.borderColor = [[UIColor redColor] CGColor];
[self.view addSubview:view];

相关文章

网友评论

    本文标题:UIView(边框和弧度)

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