feat:fix iOS render sync clip corner cannot be applied

This commit is contained in:
pengfei.zhou 2019-11-20 11:10:03 +08:00
parent 5745972f1e
commit 7f22152f27

View File

@ -147,20 +147,21 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
CGFloat rightTop = [(NSNumber *) dic[@"rightTop"] floatValue]; CGFloat rightTop = [(NSNumber *) dic[@"rightTop"] floatValue];
CGFloat rightBottom = [(NSNumber *) dic[@"rightBottom"] floatValue]; CGFloat rightBottom = [(NSNumber *) dic[@"rightBottom"] floatValue];
CGFloat leftBottom = [(NSNumber *) dic[@"leftBottom"] floatValue]; CGFloat leftBottom = [(NSNumber *) dic[@"leftBottom"] floatValue];
CALayer *mask = nil;
if (ABS(leftTop - rightTop) > CGFLOAT_MIN if (ABS(leftTop - rightTop) > CGFLOAT_MIN
|| ABS(leftTop - rightBottom) > CGFLOAT_MIN || ABS(leftTop - rightBottom) > CGFLOAT_MIN
|| ABS(leftTop - leftBottom) > CGFLOAT_MIN) { || ABS(leftTop - leftBottom) > CGFLOAT_MIN) {
view.layer.cornerRadius = 0; view.layer.cornerRadius = 0;
CAShapeLayer *shapeLayer = [CAShapeLayer layer]; dispatch_async(dispatch_get_main_queue(), ^{
CGPathRef path = DoricCreateRoundedRectPath(self.view.bounds, leftTop, rightTop, rightBottom, leftBottom); CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = path; CGPathRef path = DoricCreateRoundedRectPath(self.view.bounds, leftTop, rightTop, rightBottom, leftBottom);
CGPathRelease(path); shapeLayer.path = path;
mask = shapeLayer; CGPathRelease(path);
view.layer.mask = shapeLayer;
});
} else { } else {
view.layer.cornerRadius = leftTop; view.layer.cornerRadius = leftTop;
view.layer.mask = nil;
} }
view.layer.mask = mask;
} }
} else if ([name isEqualToString:@"shadow"]) { } else if ([name isEqualToString:@"shadow"]) {
NSDictionary *dic = prop; NSDictionary *dic = prop;