Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image processing 在iPad上渲染大型图像:崩溃_Image Processing_Crash_Ios8_Image Rendering - Fatal编程技术网

Image processing 在iPad上渲染大型图像:崩溃

Image processing 在iPad上渲染大型图像:崩溃,image-processing,crash,ios8,image-rendering,Image Processing,Crash,Ios8,Image Rendering,我正在使用下面的函数将视图渲染为图像。 问题是,对于大小超过2000px的图像,内存压力太大,应用程序崩溃。 在模拟器上,它可以在任何大小下正常工作,但在iPad2或更高版本上,内存增长超过80MB 有什么聪明的方法可以渲染大视图吗 运气好吗?我也遇到了同样的问题不,我将图像分割成小块,然后分别渲染…: -(UIImage*)renderToImageUsingContextFixedScale{ UIImage*im2; CGFloat scale = 1.0; if(UIGraphicsB

我正在使用下面的函数将视图渲染为图像。 问题是,对于大小超过2000px的图像,内存压力太大,应用程序崩溃。 在模拟器上,它可以在任何大小下正常工作,但在iPad2或更高版本上,内存增长超过80MB

有什么聪明的方法可以渲染大视图吗


运气好吗?我也遇到了同样的问题不,我将图像分割成小块,然后分别渲染…:
-(UIImage*)renderToImageUsingContextFixedScale{
UIImage*im2;
CGFloat scale = 1.0;

if(UIGraphicsBeginImageContextWithOptions != NULL)
{
    if(scale > 1.0) {
        UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, scale);
    } else {
        UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, scale);

    }
} else {
    UIGraphicsBeginImageContext(self.frame.size);
}


//::::::::::::::::
CGContextScaleCTM(UIGraphicsGetCurrentContext(), scale, scale);
//::::::::::::::::
@autoreleasepool {
    [self.layer renderInContext:UIGraphicsGetCurrentContext()];
    im2 = UIGraphicsGetImageFromCurrentImageContext();
///THE ERROR OCCURS HERE:
    UIGraphicsEndImageContext();
   }
//:::::::::::::::::::::::::::


return im2;
}