iOS: avoid view's call from non ui thread

This commit is contained in:
pengfei.zhou 2022-07-13 18:42:17 +08:00 committed by osborn
parent 9cb4764bfd
commit b4391cb0d6

View File

@ -330,10 +330,11 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
__block BOOL async = NO; __block BOOL async = NO;
view.doricLayout.undefined = YES; view.doricLayout.undefined = YES;
#if DORIC_USE_YYWEBIMAGE #if DORIC_USE_YYWEBIMAGE
UIImage *image = [self currentPlaceHolderImage];
dispatch_async([_YYWebImageSetter setterQueue], ^{ dispatch_async([_YYWebImageSetter setterQueue], ^{
[view yy_cancelCurrentImageRequest]; [view yy_cancelCurrentImageRequest];
[view yy_setImageWithURL:[NSURL URLWithString:prop] placeholder:[self currentPlaceHolderImage] options:0 completion:^(UIImage *image, NSURL *url, YYWebImageFromType from, YYWebImageStage stage, NSError *error) { [view yy_setImageWithURL:[NSURL URLWithString:prop] placeholder:image options:0 completion:^(UIImage *image, NSURL *url, YYWebImageFromType from, YYWebImageStage stage, NSError *error) {
__strong typeof(_self) self = _self; __strong typeof(_self) self = _self;
if (self.placeHolderColor || self.errorColor) { if (self.placeHolderColor || self.errorColor) {
self.view.contentMode = self.contentMode; self.view.contentMode = self.contentMode;