为什么我只能看到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);
}
答案 0 :(得分:3)
NSLog(@“x%d,y%d”,nowPoint.x,nowPoint.y);
将此更改为...
NSLog(@"x %0.02f, y %0.02f", nowPoint.x, nowPoint.y);