开发者

(cocos2d) "invalid context" error with CCLabel initialization

I'm trying to call the labelWithString function and I'm getting the following run-time errors:

Error: CGC开发者_Python百科ontextSetGrayFillColor: invalid context 0x0

Error: CGContextTranslateCTM: invalid context 0x0

Error: CGContextScaleCTM: invalid context 0x0

This is the line of code that I tracked it down to:

self.label = [CCLabel labelWithString:@"" fontName:@"Arial" fontSize:32];

Any help on the matter would be appreciated.


Looks like the call is being made either before the CG [CoreGraphics] contexts have been initialized or potentially from the wrong thread?

Need more clues. Where does the line of code appear in your app? What is the backtrace at the time of the call?


try deleting the line:

self.label = nil;
or
[label release];

on dealloc() method.

This trick works for me, but would cause memory leaks though. I'm also waiting for this issue to be fixed

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜