CGPoint giving the same value for x and y?
-
04-12-2019 - |
문제
This is a strange bug I'm experiencing when testing on an old iPod. I'm trying to get location values on touchesMoved, but the y always outputs value equal to x. If I log using NSStringFromCGPoint, then I get the correct output. How come accessing x and y separately is not working?
CGPoint location = [singleTouch locationInView:self.view];
NSLog(@"Location using NSStringFromCGPoint %@", NSStringFromCGPoint(location)); // output: {27, 136}
NSLog(@"Location using x and y %f %f",location.x, location.y); // output: 27, 27
해결책
It appears the problem didn't haven't anything to do with CGPoint but rather with the plist parameters.
This question solved my issue.
제휴하지 않습니다 StackOverflow