I have a problem retrieving a previously created CGMutablePath. I create it in touchesBegan but then when I try to retrieve it with a function (GetLastPath) it shows as nil:
This is the error I get when I try to add the retrieved path to an NSMutableArray
"*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'CGPath must be non-nil".
Help please!
This is the error I get when I try to add the retrieved path to an NSMutableArray
"*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'CGPath must be non-nil".
Help please!
Code:
CGMutablePathRef cgPath;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//code
// Create a path
cgPath = CGPathCreateMutable();
CGPathAddEllipseInRect(cgPath, NULL, CGRectMake(0, 0, 300, 300));
CGPathAddEllipseInRect(cgPath, NULL, CGRectMake(50, 50, 200, 200));
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
//code
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
//code
}
-(CGMutablePathRef)GetLastPath
{
return cgPath;
}