I looked through countless questions here and elsewhere and I canโt understand for my life what I am doing wrong.
I am trying to save an array of CGPoints as NSValues โโinside an NSMutableArray called such points on the iPhone:
NSValue *point = [NSValue valueWithCGPoint:firstTouch]; NSLog(@"NSValue *point = %@", point); [points addObject:point]; NSLOG OUTPUT NSValue *point = NSPoint: {120, 221}
Everything goes smoothly from CGPoint to NSValue. But when I try to get the point, I get nothing.
NSValue *getPoint = [points objectAtIndex:0]; CGPoint thePoint = [getPoint CGPointValue]; NSLog(@"Point = %@", NSStringFromCGPoint(thePoint)); NSLOG OUTPUT Point = {0, 0}
The points should be the same, but I get a zero result.
For testing purposes, this happens in the touchhesBegan method.
Does anyone know where I am going wrong? Thanks in advance.
source share