Thursday, March 31, 2011

iphone: How do I get the location of a touch down event?

I have an empty View-Based app. I'd like to do something with the x,y coordinates of every touch down on the screen. How do I do this?

From stackoverflow
  • Override the

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    

    function (from the NSRespondrer class). You can override it from your view class. The 'touches' variable hold a set of 'UITouch' instances that you can query for the location in the view.

  • The correct answer to this question should be RTFM (read the faq meticulously) as it's a basic tenet of the UI for iPhone.

    don't mark this down because I suggest reading the documentation - that should always be the first place to look, not asking a question online :(

    José Joel. : But It's not an answer to his question.
    KevinDTimm : baloney, it is an answer to his question :( give a man a fish, he eats for a day; teach a man to fish, he eats forever

0 comments:

Post a Comment