美文网首页
给view button画边框虚线

给view button画边框虚线

作者: 来敲代码 | 来源:发表于2019-04-10 09:33 被阅读0次
    CAShapeLayer *layer   = [[CAShapeLayer alloc] init];
    layer.frame            = CGRectMake(0, 0 , 140, 50);
    layer.backgroundColor   = [UIColor clearColor].CGColor;
    UIBezierPath *path    = [UIBezierPath bezierPathWithRoundedRect:layer.frame cornerRadius:25.0f];
    layer.path             = path.CGPath;
    layer.lineWidth         = 1.0f;
    layer.lineDashPattern    = @[@4, @4];
    layer.fillColor          = [UIColor clearColor].CGColor;
    layer.strokeColor       = [UIColor whiteColor].CGColor;
// 这里是需要添加边框的 view or  btton
    [btton.layer addSublayer:layer];
    ViewBorderRadius(NextStep, 25, 1, [UIColor whiteColor]);

相关文章

网友评论

      本文标题:给view button画边框虚线

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