(IOS)为一个view添加虚线边框

CAShapeLayer *border = [CAShapeLayer layer];

border.strokeColor = [UIColor colorWithRed:67/255.0fgreen:37/255.0fblue:83/255.0falpha:1].CGColor;

border.fillColor =nil;

border.lineDashPattern =@[@4,@2];

border.path = [UIBezierPath bezierPathWithRect:view.bounds].CGPath;

border.frame = view.bounds;

[view.layer addSublayer:border];

你可能感兴趣的:((IOS)为一个view添加虚线边框)