From e6647214dd41784adf663d3df0026a49ff40843d Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 9 Sep 2021 18:17:42 +0800 Subject: [PATCH] iOS: fix part corner with border --- doric-iOS/Pod/Classes/Shader/DoricLayouts.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m index 21134261..a6ceda6f 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m +++ b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m @@ -258,6 +258,23 @@ - (void)setFrame { CGPathRef path = DoricCreateRoundedRectPath(self.view.bounds, self.corners.top, self.corners.left, self.corners.bottom, self.corners.right); shapeLayer.path = path; + + if ((self.corners.left != self.corners.right + || self.corners.left != self.corners.top + || self.corners.left != self.corners.bottom) + && self.view.layer.borderWidth > CGFLOAT_MIN) { + CAShapeLayer *lineLayer = [CAShapeLayer layer]; + lineLayer.lineWidth = self.view.layer.borderWidth * 2; + lineLayer.strokeColor = self.view.layer.borderColor; + lineLayer.path = path; + lineLayer.fillColor = nil; + [[self.view.layer sublayers] forEach:^(__kindof CALayer *obj) { + if ([obj isKindOfClass:CAShapeLayer.class] && ((CAShapeLayer *) obj).lineWidth > CGFLOAT_MIN) { + [obj removeFromSuperlayer]; + } + }]; + [self.view.layer addSublayer:lineLayer]; + } CGPathRelease(path); self.view.layer.mask = shapeLayer; }