add scale

This commit is contained in:
王劲鹏 2020-04-17 14:12:51 +08:00 committed by osborn
parent 5d85bc86d1
commit afff5b9be0
2 changed files with 8 additions and 8 deletions

View File

@ -121,8 +121,8 @@ class ImageDemo extends Panel {
stretchInset: { stretchInset: {
left: 374, left: 374,
top: 0, top: 0,
right: 375, right: 66,
bottom: 198 bottom: 0
} }
}) })
], ],

View File

@ -228,12 +228,12 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
} }
} else if ([@"stretchInset" isEqualToString:name]) { } else if ([@"stretchInset" isEqualToString:name]) {
NSDictionary * stretchInsetDic = (NSDictionary *)prop; NSDictionary * stretchInsetDic = (NSDictionary *)prop;
int left = [stretchInsetDic[@"left"] intValue]; CGFloat left = [stretchInsetDic[@"left"] floatValue];
int top = [stretchInsetDic[@"top"] intValue]; CGFloat top = [stretchInsetDic[@"top"] floatValue];
int right = [stretchInsetDic[@"right"] intValue]; CGFloat right = [stretchInsetDic[@"right"] floatValue];
int bottom = [stretchInsetDic[@"bottom"] intValue]; CGFloat bottom = [stretchInsetDic[@"bottom"] floatValue];
UIImage *scaled = [[UIImage alloc] initWithCGImage:view.image.CGImage scale:[[UIScreen mainScreen] scale] orientation:view.image.imageOrientation];
UIImage *result = [view.image resizableImageWithCapInsets:UIEdgeInsetsMake(top - 0.1, left - 0.1, bottom - 0.1, view.image.size.width - right + 0.1) resizingMode:UIImageResizingModeStretch]; UIImage *result = [scaled resizableImageWithCapInsets:UIEdgeInsetsMake(0, 125, 0, 22) resizingMode:UIImageResizingModeStretch];
view.image = result; view.image = result;
} else { } else {
[super blendView:view forPropName:name propValue:prop]; [super blendView:view forPropName:name propValue:prop];