Iphone UIGraphicsGetImageFromCurrentImageContext()视网膜分辨率?

Iphone UIGraphicsGetImageFromCurrentImageContext()视网膜分辨率?,iphone,cocoa-touch,Iphone,Cocoa Touch,我正在拍摄屏幕的照片,并使用UIGraphicsGetImageFromCurrentImageContext()对其进行操作。一切正常。然而,在iPhone4上,分辨率看起来相当糟糕,因为它使用的图像似乎是标准分辨率,而不是@2x。有没有办法提高结果图像的分辨率 UIGraphicsBeginImageContext(self.view.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

我正在拍摄屏幕的照片,并使用
UIGraphicsGetImageFromCurrentImageContext()
对其进行操作。一切正常。然而,在iPhone4上,分辨率看起来相当糟糕,因为它使用的图像似乎是标准分辨率,而不是@2x。有没有办法提高结果图像的分辨率

UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

您应该使用
UIGraphicsBeginImageContextWithOptions
,它允许您设置比例因子。使用0.0f的比例因子来使用设备的比例因子。

对于将来看到这种情况的人,这仅适用于iOS 4+版本。