每次我在模拟器或iPhone上运行我的应用程序时,控制台都会显示以下语句。
它究竟想说什么?
**
*尝试弹出未知的自动释放池(0x6830200)
<错误>:CGContextScaleCTM:无效的上下文0x0
<错误>:CGContextTranslateCTM:无效的上下文0x0
<错误>:CGContextConcatCTM:无效的上下文0x0
<错误>:CGContextDrawImage:无效的上下文0x0
<错误>:CGContextScaleCTM:无效的上下文0x0
<错误>:CGContextTranslateCTM:无效的上下文0x0
<错误>:CGContextConcatCTM:无效的上下文0x0
<错误>:CGContextDrawImage:无效的上下文0x0
<错误>:CGContextScaleCTM:无效的上下文0x0
<错误>:CGContextTranslateCTM:无效的上下文0x0
<错误>:CGContextConcatCTM:无效的上下文0x0
<错误>:CGContextTranslateCTM:无效的上下文0x0
<错误>:CGContextConcatCTM:无效的上下文0x0
<错误>:CGContextDrawImage:无效的上下文0x0
如何解决?
以下是imgPic是UIImage实例的参考代码......
int kMaxResolution = 640;
CGImageRef imgRef = imgPic.CGImage;
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGAffineTransform transform = CGAffineTransformIdentity;
CGRect bounds = CGRectMake(0, 0, width, height);
if (width > kMaxResolution || height > kMaxResolution)
{
CGFloat ratio = width/height;
if (ratio > 1)
{
bounds.size.width = kMaxResolution;
bounds.size.height = roundf(bounds.size.width / ratio);
}
else
{
bounds.size.height = kMaxResolution;
bounds.size.width = roundf(bounds.size.height * ratio);
}
}
CGFloat scaleRatio = bounds.size.width / width;
CGSize imageSize = CGSizeMake(CGImageGetWidth(imgRef), CGImageGetHeight(imgRef));
CGFloat boundHeight;
UIGraphicsBeginImageContext(bounds.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextScaleCTM(context, scaleRatio, -scaleRatio);
CGContextTranslateCTM(context, 0, -height);
CGContextConcatCTM(context, transform);
CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, width, height), imgRef);
UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
答案 0 :(得分:1)
我认为他试图告诉你,你的背景无效。 :)