我在swift中使用下面的代碼將UIImageView捕獲到一個圖像中。它可以工作,但圖像質量不如UIImageView上顯示的質量。捕捉此圖像時是否有配置質量的方法?在swift中渲染UIImageView時質量鬆散
private func getScreenshow(imageView:UIImageView) -> UIImage{
UIGraphicsBeginImageContext(self.imageView.frame.size)
let context = UIGraphicsGetCurrentContext()
imageView.layer.renderInContext(context!)
let screenShot = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
UIImageWriteToSavedPhotosAlbum(screenShot, nil, nil, nil)
return screenShot
}
因爲在imageView上顯示了許多其他子視圖。 –
按問題與此問題無關,因爲我正在將UIBezierPath轉換爲UIImage。然而,你對比例因子的評論是我忽略的。出於某種原因,我把scale設爲1.我做到了0,一切看起來很美!謝謝! :) –