试图用文本保存 UIImage,它在 iPad 中看起来像模糊swift

问题描述

我正在尝试将视图导出为 UIImage

extension UIImage {
    convenience init(view: UIView,originalImageSize: CGSize) {
        var campusSize = originalImageSize
        var scale : CGFloat = UIScreen.main.scale

        UIGraphicsBeginImageContextWithOptions(campusSize,false,scale)
        defer {
            UIGraphicsEndImageContext()
        }
        view.drawHierarchy(in: CGRect(x: 0,y: 0,width: imageWidth,height: imageHeight),afterScreenUpdates: true)
        let image = UIGraphicsGetImageFromCurrentImageContext()!
        self.init(cgImage: image.cgImage!)
  }
}

但是导出图像看起来很模糊? 12.9 英寸以下 iPad 出现模糊或数字噪点

iPad 11 英寸

enter image description here

iPhone 和 iPad 12.9 英寸

enter image description here

我试过了

首先,我尝试了这样的方式,这是框架积分之后的 -> CGRectIntegral what is the usage of it?

editViewContainterViewFrame.integral

它已在 iPhone 设备和 iPad 12.9 英寸设备中修复

问题

问题是在 iPhone 和 iPad 12.9inch 中没有发生 此问题发生在 iPad 12.9 英寸以下的小型 iPad 设备中,例如 11 英寸、10.9 英寸等...

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...