2011-02-11 105 views
36

我正在拍攝我的屏幕並使用UIGraphicsGetImageFromCurrentImageContext()來操作它。一切都很好。但是,在iPhone 4上,分辨率看起來很破舊,因爲它看起來像使用的圖像是標準分辨率,而不是@ 2x。有什麼辦法可以提高生成圖像的分辨率嗎?UIGraphicsGetImageFromCurrentImageContext()視網膜分辨率?

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

回答

89

您應該使用UIGraphicsBeginImageContextWithOptions它允許您設置比例因子。使用0.0f的比例因子來使用設備的比例因子。

+4

對於任何未來看到此內容的人,這僅適用於iOS 4+。 – 2011-02-21 15:30:56

相關問題