Getting x/y coordinate of a UITouch...

Posted by Tarek on Stack Overflow See other posts from Stack Overflow or by Tarek
Published on 2010-06-08T20:29:37Z Indexed on 2010/06/08 20:32 UTC
Read the original article Hit count: 331

HI,

I have been trying to get the x/y coordinates from a touch on any iDevice.

When getting the touch locations, everything looks ok if the touch is in the middle of the screen. But if I drag my finger to the bottom of the screen, I can only get a y coordinate of 1015. It should be getting to 1023. Same thing for dragging my finger to the top of the screen. I get -6. It should be 0. I have explicitly set the window and views to an origin of 0,0 and the width, height of the device's screen. Still nothing.

I am really lost on what might be going on. Is something shifted? Am I not reading the x/y coordinates properly. Does something need to be transformed or converted?

Any help would be much appreciated.

T

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about uiview