Images below IOS 14 cannot be loaded, including weex, yyanimateview and sdanimateimageview

Time:2020-10-4

After xcode12 is upgraded, it is found that the large and large images cannot be loaded, including the pictures of weex and yyanimateview.

After some research, it is found that the UIKit pair under IOS 14displayLayer:The treatment mechanism of the disease has changed.
displayLayer:yesCALayerDelegateProxy method. Before IOS 14, UIKit rendered before calling this methodUIImageView.image
In IOS 14, UIKit calls the proxy method first, if you implement itdisplayLayer:In this way, UIKit will not render again.

If it is changed to the following, it can be loaded normally:

- (void)displayLayer:(CALayer *)layer {
    UIImage *currentFrame = _curFrame;
    if (currentFrame) {
        layer.contentsScale = currentFrame.scale;
        layer.contents = (__bridge id)currentFrame.CGImage;
    } else {
        // If we have no animation frames, call super implementation. iOS 14+ UIImageView use this delegate method for rendering.
        if ([UIImageView instancesRespondToSelector:@selector(displayLayer:)]) {
           [super displayLayer:layer];
        }
    }
//    if (_curFrame) {
//        layer.contents = (__bridge id)_curFrame.CGImage;
//    }
}

reference resources:

  1. https://github.com/apache/inc…
  2. https://github.com/ibireme/YY…
  3. https://github.com/SDWebImage…

Original address:https://y500.me/2020/09/29/im…

Recommended Today

Deeply analyze the principle and practice of RSA key

1、 Preface After experiencing many dark moments in life, when you read this article, you will regret and even be angry: why didn’t you write this article earlier?! Your darkest moments include: 1. Your project needs to be connected with the bank, and the other party needs you to provide an encryption certificate. You have […]