CGContextShowTextAtPoint: invalid context

Posted by coure06 on Stack Overflow See other posts from Stack Overflow or by coure06
Published on 2010-05-26T18:30:16Z Indexed on 2010/05/26 18:31 UTC
Read the original article Hit count: 274

Filed under:
|
|

I want to call a method responsible for drawing text on screen after each 5 seconds. Here is my code
-(void) handleTimer: (NSTimer *)timer { CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetLineWidth(context, 2.0); CGContextSetStrokeColorWithColor(context, currentColor.CGColor);

CGContextTranslateCTM(context, 145.0, 240.0); CGContextScaleCTM(context, 1.0, -1.0); CGContextSelectFont(context, "Arial", 18, kCGEncodingMacRoman); CGContextSetCharacterSpacing(context, 1); CGContextSetTextDrawingMode(context, kCGTextFillStroke);

CGContextSetRGBStrokeColor(context, 0.5,0.5,1,1); CGContextShowTextAtPoint(context, 100, 100, "01", 2); }
But after 5 seconds when this method is called i am getting this error
CGContextShowTextAtPoint: invalid context

Another thing is how to show a thinner font?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone-sdk