I want to capture a particular portion of iPhone screen. I used UIGraphicsBeginImageContextWithOptions, but couldn\'t capture a portion of screen with this.
Ple
Another method to capture clear screenshot;
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
UIGraphicsBeginImageContextWithOptions(self.captureView.frame.size, NO, [UIScreen mainScreen].scale);
else
UIGraphicsBeginImageContext(self.captureView.frame.size);
[self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
[viewImage drawInRect:CGRectMake(0.0, 0.0, 640,960)];
//NSData*m_Imgdata=UIImagePNGRepresentation(viewImage);
NSData*m_Imgdata=UIImageJPEGRepresentation(viewImage, 1.0);
// UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
UIGraphicsEndImageContext();