imageWithCGImage:scale:orientation api ios13 相对于 gif 图片的变化
Changes in imageWithCGImage:scale:orientation api ios13 with respect to gif images
我正在使用一些自定义代码在 UIImageView 中呈现 gif。以下是使用的代码link
https://github.com/swiftgif/SwiftGif/blob/master/SwiftGifCommon/UIImage%2BGif.swift
我稍微更改了代码以尊重不同分辨率设备的比例。下面是代码。
frame = UIImage(cgImage: images[Int(index)], scale: UIScreen.main.scale, orientation: .up)
直到 iOS12 这工作正常,图像根据设备进行了缩放和缩小。从 iOS13 开始,如果使用 @2x、@3x 图像,则它们会被缩放,并且缩放比例也没有得到遵守。
在 iOS 上尝试了其他几种 gif 渲染技术,但没有用。任何人都可以建议 api 发生了什么,如果他们遇到了同样的问题。
当我将图像数组直接设置为 "animatedImages" 属性 而不是使用创建 UIImage 时,这个问题得到了解决
“[UIImage animatedImageWithImages:frames 持续时间:(NSTimeInterval)]” api.
我正在使用一些自定义代码在 UIImageView 中呈现 gif。以下是使用的代码link
https://github.com/swiftgif/SwiftGif/blob/master/SwiftGifCommon/UIImage%2BGif.swift
我稍微更改了代码以尊重不同分辨率设备的比例。下面是代码。
frame = UIImage(cgImage: images[Int(index)], scale: UIScreen.main.scale, orientation: .up)
直到 iOS12 这工作正常,图像根据设备进行了缩放和缩小。从 iOS13 开始,如果使用 @2x、@3x 图像,则它们会被缩放,并且缩放比例也没有得到遵守。
在 iOS 上尝试了其他几种 gif 渲染技术,但没有用。任何人都可以建议 api 发生了什么,如果他们遇到了同样的问题。
当我将图像数组直接设置为 "animatedImages" 属性 而不是使用创建 UIImage 时,这个问题得到了解决 “[UIImage animatedImageWithImages:frames 持续时间:(NSTimeInterval)]” api.