【发布时间】:2009-10-04 17:34:20
【问题描述】:
Apples 文档指出 Quartz2D 通常为thread-safe。但是,在 NSOperation 期间绘制到图像上下文时,我遇到了崩溃(EXC_BAD_ACCESS)。
这是我目前的设置:
UIGraphicsBeginImageContext(imageSize);
CGContextRef context = UIGraphicsGetCurrentContext();
// drawing code
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
我怀疑崩溃与当前上下文有关,因为 UIGraphicsGetCurrentContext 文档声明它需要从 main thread 调用。它是否正确?还有其他获取图像上下文的方法吗?
【问题讨论】:
-
不,这是不正确的,文档决定对你撒谎只是为了好玩……
标签: iphone cocoa-touch multithreading quartz-2d nsoperation