-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ios 14 YYAnimatedImageView 加载不出图片 #242
Comments
ios 14 YYAnimatedImageView 加载不出图片。用Xcode-beta 12.0版的。 |
ios14里重写了 - (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;
// }
} |
没什么用啊? |
我这儿是没问题的啊,改了就好了 |
这里的Voice 是Gif 图片 只播放一下 就暂停了 但是在IOS14以下 就可以循环播放 |
这和我说的不是一个问题啊……我说的是ios14beta上,YYImageView加载不出普通的图片,然后改了就可以加载出来了。 |
好吧
…------------------ 原始邮件 ------------------
发件人: "mlch911"<notifications@github.com>;
发送时间: 2020年9月24日(星期四) 上午10:35
收件人: "ibireme/YYWebImage"<YYWebImage@noreply.github.com>;
抄送: "若干年后"<905430956@qq.com>; "Comment"<comment@noreply.github.com>;
主题: Re: [ibireme/YYWebImage] ios 14 YYAnimatedImageView 加载不出图片 (#242)
ios14里重写了displayLayer:方法会有问题,看了下,应该是这样改。最下边注释的是原来的,不知道正式版的苹果会不会修复这个问题。
- (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; // } }
没什么用啊?
我这儿是没问题的啊,改了就好了
YYAnimatedImageView *imageView = [[YYAnimatedImageView alloc] initWithImage:[YYImage imageNamed:@"voice"]]; imageView.frame = CGRectMake(100, 100, 50, 50); [self.view addSubview:imageView];
这里的Voice 是Gif 图片 只播放一下 就暂停了 但是在IOS14以下 就可以循环播放
这和我说的不是一个问题啊……我说的是ios14beta上,YYImageView加载不出普通的图片,然后改了就可以加载出来了。
你这个问题,你再找找别的吧
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
写了个分类 .h
.m
|
@NicofnCHINA NICE完美解决方案~ |
good job |
ios14 有两个问题: |
播放一遍的问题,可以看下 loopcount 的值 |
Gif图循环次数为1,在iOS14系统上就只播放一次,让UI重新生成一下gif即可。 |
我测试了下,没问题,大佬 |
works well in iOS 15.3, great! |
import YYImage
extension YYAnimatedImageView {
override open func display(_ layer: CALayer) {
let currentFrame = value(forKeyPath: "_curFrame") as? UIImage
if currentFrame != nil {
layer.contentsScale = currentFrame!.scale
layer.contents = currentFrame!.cgImage
} else {
if UIImageView.instancesRespond(to: #selector(display(_:))) {
super.display(layer)
}
}
}
} This is a swift 5.5 version extension, will fix this bug. |
ios 14 YYAnimatedImageView 加载不出图片
The text was updated successfully, but these errors were encountered: