【问题标题】:Error messages in Console控制台中的错误消息
【发布时间】:2011-07-27 08:27:02
【问题描述】:

每当我在模拟器或 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();

【问题讨论】:

  • 我有这个...我修好了,但老实说我不记得怎么修了。你在做自定义绘图吗?如果是这样,您可以发布代码吗?
  • 我正在尝试从 Web 服务加载异步图像下载。
  • 你能发布下载这张图片的实际代码吗?
  • 我已经发布了代码。请告诉我,问题到底出在哪里。!

标签: objective-c xcode ios4 cgcontext


【解决方案1】:

我认为他试图告诉您您的上下文无效。 :)

【讨论】:

  • 有什么合适的方法可以找出这些问题出现在哪里?
  • 你的上下文有效吗?你检查它是否不为空?
猜你喜欢
  • 1970-01-01
  • 2015-08-29
  • 1970-01-01
  • 1970-01-01
  • 2020-10-21
  • 1970-01-01
  • 1970-01-01
  • 2021-04-20
  • 1970-01-01
相关资源
最近更新 更多