iOS:fix iOS 14 cannot display image
This commit is contained in:
parent
b9b0ce22b2
commit
171e96d0b5
@ -30,6 +30,17 @@ @interface DoricImageView : YYAnimatedImageView
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation DoricImageView
|
@implementation DoricImageView
|
||||||
|
- (void)displayLayer:(CALayer *)layer {
|
||||||
|
if (@available(iOS 14.0, *)) {
|
||||||
|
if (self.isAnimating) {
|
||||||
|
[super displayLayer:layer];
|
||||||
|
} else {
|
||||||
|
layer.contents = (__bridge id) self.image.CGImage;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
[super displayLayer:layer];
|
||||||
|
}
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface DoricImageNode ()
|
@interface DoricImageNode ()
|
||||||
@ -276,7 +287,7 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ([@"stretchInset" isEqualToString:name]) {
|
} else if ([@"stretchInset" isEqualToString:name]) {
|
||||||
self.stretchInsetDic = (NSDictionary *)prop;
|
self.stretchInsetDic = (NSDictionary *) prop;
|
||||||
} else if ([@"imageScale" isEqualToString:name]) {
|
} else if ([@"imageScale" isEqualToString:name]) {
|
||||||
//Do not need set
|
//Do not need set
|
||||||
} else {
|
} else {
|
||||||
@ -291,7 +302,7 @@ - (void)afterBlended:(NSDictionary *)props {
|
|||||||
CGFloat right = [self.stretchInsetDic[@"right"] floatValue];
|
CGFloat right = [self.stretchInsetDic[@"right"] floatValue];
|
||||||
CGFloat bottom = [self.stretchInsetDic[@"bottom"] floatValue];
|
CGFloat bottom = [self.stretchInsetDic[@"bottom"] floatValue];
|
||||||
CGFloat scale = self.imageScale;
|
CGFloat scale = self.imageScale;
|
||||||
UIImage *result = [self.view.image resizableImageWithCapInsets:UIEdgeInsetsMake(top/scale, left/scale, bottom/scale, right/scale) resizingMode:UIImageResizingModeStretch];
|
UIImage *result = [self.view.image resizableImageWithCapInsets:UIEdgeInsetsMake(top / scale, left / scale, bottom / scale, right / scale) resizingMode:UIImageResizingModeStretch];
|
||||||
self.view.image = result;
|
self.view.image = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user