Question

Why can I only see the "y" component of nowPoint changing, ["x" component is always "0"] ??

- (void) touchesMoved: (NSSet *) touches withEvent: (UIEvent *) event {
    [super touchesMoved:touches withEvent:event];

    CGPoint nowPoint = [[touches anyObject] locationInView:self.view];
    CGPoint prevPoint = [[touches anyObject] previousLocationInView:self.view];

    NSLog(@"x %d,   y %d", nowPoint.x, nowPoint.y);
}
Was it helpful?

Solution

NSLog(@"x %d, y %d", nowPoint.x, nowPoint.y);

Change this to...

NSLog(@"x %0.02f,   y %0.02f", nowPoint.x, nowPoint.y);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top