Info | Value |
-------------------------|-------------------------------------|
Platform Name | iOS
Platform Version | 14.0
SDWebImage Version | 5.8.1
Integration Method | CocoaPods
Xcode Version | 12.0 beta (12A6159)
Repro rate | 100%
This doesn't render anything:
SDAnimatedImageView *imageView = [SDAnimatedImageView new];
imageView.image = [UIImage systemImageNamed:@"trash"];
imageView.backgroundColor = [UIColor redColor];
imageView.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:imageView];
UIImageView works fine:
UIImageView *imageView = [UIImageView new];
imageView.image = [UIImage systemImageNamed:@"trash"];
imageView.backgroundColor = [UIColor redColor];
imageView.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:imageView];
Building the repro code with Xcode 11 works fine as well.
The root cause might be currentFrame is nil, and displayLayer: doesn't do anything.
@cyanzhong This effect only some custom codec like Static WebP. For SDAnimatedImageIOCoder like GIF/APNG, it does not get effected. Animated WebP works as well.
This is not related to that currentFrame is nil. The SDAnimatedImageView.image != nil, however, UIKit does not render the CGImage. (However, why does Xcode View Debug show that Image as normal ? 馃槙 )

Seems some hack from Apple UIKit team that break the UIImage subclass to work. Invesiting. I guess maybe something about CGImageCreate or color profile.
Seems some break change to that displayLayer: delegate method.
on iOS 13: If we override this, UIKit will render the UIImageView.image itself before calling this method. So even if self.currentFrame == nil, the UIImageView.image get rendered.
on iOS 14: UIKit no longer render anything if you override that displayLayer: method. We can have a backup to render layer.contents for this case by ourself.
Temp workaround:

We also meet it , waiting for apple fix it
@cyanzhong @lvyuqiang
Release v5.8.2 Patch version
mark
Most helpful comment
Seems some break change to that
displayLayer:delegate method.on iOS 13: If we override this, UIKit will render the
UIImageView.imageitself before calling this method. So even ifself.currentFrame == nil, theUIImageView.imageget rendered.on iOS 14: UIKit no longer render anything if you override that
displayLayer:method. We can have a backup to renderlayer.contentsfor this case by ourself.Temp workaround: