画面上のビューをキャプチャするために次のコードを使用していますが、画面上ほど鮮明ではありません。imageViewのサイズは200x200ポイントですが、スケールは2.0です(網膜スクリーンを使用)。保存
img
されるサイズは200x200ピクセルです。どうすればimg
元のシャープと同じくらいシャープにすることができますか?どんな助けでもありがたいです!
- (UIImage*)captureView:(UIView *)theView {
CGRect rect = theView.frame;
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[theView.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}