// // CustomBorderView.m // IBOSS-HJ // // Created by 关宏厚 on 2021/1/5. // Copyright © 2021 elongtian. All rights reserved. // #import "CustomBorderView.h" @implementation CustomBorderView -(void) drawBoardLine:(double)width cornerRadius:(double)cornerRadius color:(UIColor*)color { self.layer.cornerRadius = cornerRadius; CAShapeLayer *borderLayer = [CAShapeLayer layer]; borderLayer.bounds = self.bounds; borderLayer.position = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); borderLayer.path = [UIBezierPath bezierPathWithRoundedRect:borderLayer.bounds cornerRadius:cornerRadius].CGPath; borderLayer.lineWidth = width; //实线边框 borderLayer.fillColor = [UIColor clearColor].CGColor; borderLayer.strokeColor = color.CGColor; [ self. layer addSublayer :borderLayer]; } @end