UIGraphicsGetImageFromCurrentImageContext()崩溃iPad 3上的应用程序

时间:2015-02-06 05:31:37

标签: ios objective-c ipad uiimageview uiimage

我的问题是,当我将UIGraphicsGetImageFromCurrentImageContext()返回的图像多次分配给UIImageView时,我的应用程序崩溃了。这是我的代码:如果省略UIImageView应用程序的分配行不会崩溃。

 UIImage *   newImage3;  
   UIGraphicsBeginImageContext(duplicateImage.size);

            [duplicateImage drawAtPoint:CGPointMake(0, 0)];


            context2=UIGraphicsGetCurrentContext();

            for(int k=0; k<kmtaGroup->TotalLines; k++)
            {
                lineObject=&kmtaGroup->Line_INFO_OBJ[k];
                x0 = lineObject->x0;
                y0= lineObject->y0;
                x1= lineObject->x1;
                y1= lineObject->y1;
                color= lineObject->Color;
                lineWidth= lineObject->LinkWidth;

                lineColor=[self add_colorWithRGBAHexValue:color];
                linearColor=lineColor;

                // Brush width
                CGContextSetLineWidth(context2, lineWidth);
                // Line Color
                CGContextSetStrokeColorWithColor(context2,[linearColor CGColor]);


                CGContextMoveToPoint(context2, x0, y0);

                CGContextAddLineToPoint(context2, x1, y1);
                CGContextStrokePath(context2);


            }



             newImage3=UIGraphicsGetImageFromCurrentImageContext();

        }

              imageView.image=newImage3;

             UIGraphicsEndImageContext();

0 个答案:

没有答案