I have an iPad application that uses the whole screen (that is, UIStatusBarHidden
is set true in the Info.plist file). The main window's and main view's frames are set to (0, 0, 768, 1024). The main view has multitouch enabled.
The view controller has this code to handle touches:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
for (UITouch *touch in touches) {
CGPoint location = [touch locationInView:nil];
NSLog(@"touchesMoved at location %@", NSStringFromCGPoint(location));
}
}
When I run the app in the simulator, it works pretty much as expected. As I move the mouse from one edge of the screen to the other, reported X values go from 0 to 767. Reported Y values go from 20 to 1023. (It is a known issue that the simulator doesn't report touches in the top 20 pixels of the screen, even when there is no status bar.)
Here's what's weird: When I run the app on an actual iPad, the X values go from 0 to 767 as expected, but reported Y values go from -6 to 1017, not 0 to 1023 as I would expect.
The fact that it seems to work properly on the simulator leads me to suspect that real devices' touchscreens are not perfectly calibrated, and mine is simply reporting Y values that are six pixels off. Can anyone verify that this is the case? Otherwise, is there anything else that could account for the Y values being six pixels off from what I expect?
(In a few days, I should have a second iPad, so I can test this with another device and compare the results.)