Я хочу сохранить изображение, нарисованное на экране iphone, в папке документов с высоким разрешением.Здесь я могу сохранить изображения в папке документов, но разрешение очень низкое.Может кто-нибудь сказать мне, как решить эту задачу.
Вот мой код
UIImage *image = [[UIImage alloc]init];
double resolution = 50;
//CGSize pageSize = CGSizeMake(612, 792);
// CGRect boundsRect = CGRectMake(50, 50, 512, 692);
CGRect boundsRect = CGRectMake(0, 0, 612, 792);
double imageWidth = image.size.width * image.scale * 72 / resolution;
double imageHeight = image.size.height * image.scale * 72 / resolution;
double sx = imageWidth / boundsRect.size.width;
double sy = imageHeight / boundsRect.size.height;
// At least one image edge is larger than maxBoundsRect
if ((sx > 1) || (sy > 1)) {
double maxScale = sx > sy ? sx : sy;
imageWidth = imageWidth / maxScale;
imageHeight = imageHeight / maxScale;
}
// Put the image in the top left corner of the bounding rectangle
CGRect bounds = CGRectMake(boundsRect.origin.x, boundsRect.origin.y + boundsRect.size.height - imageHeight, imageWidth, imageHeight);
CGSize size = bounds.size;
// UIGraphicsBeginImageContextWithOptions(size,NO,10.0f);
UIGraphicsBeginImageContext(size);
{
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
image = UIGraphicsGetImageFromCurrentImageContext();
}