1

为什么我只能看到 nowPoint 的“y”分量在变化,[“x”分量总是“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);
}
4

1 回答 1

3

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

将此更改为...

NSLog(@"x %0.02f,   y %0.02f", nowPoint.x, nowPoint.y);
于 2011-05-25T03:44:54.043 回答