如何清除屏幕截图IOS

前端之家收集整理的这篇文章主要介绍了如何清除屏幕截图IOS前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在研究 IOS应用程序,其中需要采取清晰的屏幕截图我已经尝试过了
func captureView() -> UIImage {
        //hide controls if needed
        let rect: CGRect = self.imageView.frame
        UIGraphicsBeginImageContext(rect.size)
        let context: CGContextRef = UIGraphicsGetCurrentContext()!
        self.view.layer.renderInContext(context)
        let img: UIImage = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return img
    }

但是图像的质量并不好.请为我推荐一些东西.

解决方法

换线
UIGraphicsBeginImageContext(rect.size)

UIGraphicsBeginImageContextWithOptions(rect.size,false,0.0);
原文链接:https://www.f2er.com/iOS/331159.html

猜你在找的iOS相关文章