我是否需要释放从UIGraphicsGetCurrentContext()返回的上下文?

kir*_*ran 23 iphone cocoa-touch core-graphics

我在用CGContextRef.

UIGraphicsBeginImageContext(self.drawImage.frame.size);
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(context,0.0f,0.0f,0.0f,1.0f);
UIGraphicsEndImageContext();
CGContextRelease(context);
Run Code Online (Sandbox Code Playgroud)

我是否需要拨打CGContextRelease(Context);上述电话.

Nik*_*uhe 28

没有.

请参阅创建规则与获取规则:

创建规则

Core Foundation函数具有指示您拥有返回对象的名称:

在名称中嵌入"创建"的对象创建函数; 对象复制函数,名称中嵌入了"复制".

[...]

获取规则

如果您从任何Core Foundation函数接收对象而不是创建或复制功能 - 例如Get函数 - 您不拥有它[...]