I know that you are supposed to put your CGContextRef stuff in the drawView: method, but I want to put it in my view controllers viewDidLoad method.
When I use UIGraphicsPushContext(myContext) I still get some errors / just doesn't draw.
A fast, easy to use, free, and community supported 2D game engine
I know that you are supposed to put your CGContextRef stuff in the drawView: method, but I want to put it in my view controllers viewDidLoad method.
When I use UIGraphicsPushContext(myContext) I still get some errors / just doesn't draw.
Im also trying to use CGContextRef inside the draw function in a CCLayer subclass, but it doesnt draw anything,
@implementation TestLayer
- (void)draw {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0);
CGContextSetLineWidth(context, 2.0);
CGContextBeginPath(context);
CGContextMoveToPoint(context, 100, 100);
CGContextAddLineToPoint(context, 300, 300);
CGContextStrokePath(context);
CGContextFlush(context);
}
@end
any help would be much appreciated, thanks.
You must log in to post.