I am trying to save the edited UIscrollView into UIImage using following code. But what I see in the view is not what I saved. It was somehow offset with a blank grey color bar at the side of the saved photo. My UIscrollView is not touching the frame of the view. Anyone have idea on how to go about? If I have to use “theScrollView.layer” to render it. The picture will get worst after I zoom in the photo.
CGSize photoSize = theScrollView.bounds.size;
UIGraphicsBeginImageContext(photoSize);
CGContextRef context = UIGraphicsGetCurrentContext();
CALayer *layer = self.view.layer;
[layer renderInContext:context];
UIImage *someImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(someImage,nil, nil, nil);
replace
CGContextRef context = UIGraphicsGetCurrentContext();withif ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])UIGraphicsBeginImageContextWithOptions(self.PostView.bounds.size, NO, [UIScreen mainScreen].scale);
else
UIGraphicsBeginImageContext(self.PostView.bounds.size);
This may help if u capture from Retina Display.
Good Luck