【问题标题】:UIGraphicsGetImageFromCurrentImageContext() Retina resolution?UIGraphicsGetImageFromCurrentImageContext() 视网膜分辨率?
【发布时间】:2011-02-11 02:26:56
【问题描述】:

我正在为我的屏幕拍照并使用UIGraphicsGetImageFromCurrentImageContext() 对其进行操作。一切正常。但是,在 iPhone 4 上,分辨率看起来很破旧,因为它使用的图像似乎是标准分辨率,而不是 @2x。有什么办法可以提高生成图像的分辨率?

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

【问题讨论】:

    标签: iphone cocoa-touch


    【解决方案1】:

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

    【讨论】:

    • 对于将来看到此内容的任何人,这仅适用于 iOS 4+。
    猜你喜欢
    • 2014-01-05
    • 2013-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-15
    • 1970-01-01
    相关资源
    最近更新 更多