UIGraphicsGetImageFromCurrentImageContext()视网膜分辨率?

时间:2011-02-11 02:26:56

标签: iphone cocoa-touch

我正在拍摄我的屏幕并使用UIGraphicsGetImageFromCurrentImageContext()进行操作。一切都很好。然而,在iPhone 4上,分辨率看起来很破旧,因为它使用的图像似乎是标准分辨率,而不是@ 2x。有没有办法提高结果图像的分辨率?

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

1 个答案:

答案 0 :(得分:89)

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

相关问题