feat:Image add base64 support for iOS

This commit is contained in:
pengfei.zhou 2019-11-25 11:19:30 +08:00
parent bc12ba9ac1
commit 7ae868591f

View File

@ -72,6 +72,15 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
} }
} else if ([@"loadCallback" isEqualToString:name]) { } else if ([@"loadCallback" isEqualToString:name]) {
self.loadCallbackId = prop; self.loadCallbackId = prop;
} else if ([@"imageBase64" isEqualToString:name]) {
NSString *base64 = prop;
if (YES == [base64 hasPrefix:@"data:image"]) {
base64 = [base64 componentsSeparatedByString:@","].lastObject;
}
NSData *imageData = [[NSData alloc] initWithBase64EncodedString:base64
options:NSDataBase64DecodingIgnoreUnknownCharacters];
UIImage *image = [UIImage imageWithData:imageData];
self.view.image = image;
} else { } else {
[super blendView:view forPropName:name propValue:prop]; [super blendView:view forPropName:name propValue:prop];
} }