iOS: implement stretchInset for ImageNode

This commit is contained in:
王劲鹏 2020-04-16 19:32:25 +08:00 committed by osborn
parent b1c1650478
commit 5d85bc86d1

View File

@ -226,6 +226,15 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
[self callJSResponse:self.loadCallbackId, nil];
}
}
} else if ([@"stretchInset" isEqualToString:name]) {
NSDictionary * stretchInsetDic = (NSDictionary *)prop;
int left = [stretchInsetDic[@"left"] intValue];
int top = [stretchInsetDic[@"top"] intValue];
int right = [stretchInsetDic[@"right"] intValue];
int bottom = [stretchInsetDic[@"bottom"] intValue];
UIImage *result = [view.image resizableImageWithCapInsets:UIEdgeInsetsMake(top - 0.1, left - 0.1, bottom - 0.1, view.image.size.width - right + 0.1) resizingMode:UIImageResizingModeStretch];
view.image = result;
} else {
[super blendView:view forPropName:name propValue:prop];
}