Touch Events

Apprentice
Posts: 10
Joined: 2008.12
Post: #1
Hello, just wondering if there are certain variables or functions that return if the user has swiped his/her finger on the iPhone's screen. I read in the UITouch Reference:

Quote:whether the finger is swiped (and if so, in which direction)

I'm just looking for a specific function that will tell me if this has happened. If there isn't one, then is it all done manually? Thanks

Al
Quote this message in a reply
Member
Posts: 269
Joined: 2005.04
Post: #2
You've got to handle swipes and pinches and what not yourself. The system only provides began/ended/cancelled/moved.
Quote this message in a reply
Apprentice
Posts: 10
Joined: 2008.12
Post: #3
Hmm, I'll hopefully think of some way to implement that. Thanks again.
Quote this message in a reply
Apprentice
Posts: 8
Joined: 2008.12
Post: #4
I'll see if this gets an answer on this thread beforee posting my own!

I'm trying to get multi-touch working. So far I have this...

Code:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
      UITouch *touch = [touches anyObject];
      CGPoint Point = [touch locationInView:self];

      printf("Touch Began\n");

   /*
      Do stuff with point.x and point.y
   */
}

Which works perfectly well, I can sure enough point and do stuff. When I touch my finger on the screen, I get the debug 'Touch Began' as expected. However, if I keep that finger down, then put another one down, then I dont see the debug again.

This leads me to believe that this function is only beign called once, when I would expect it to be called every time I put a new finger on the screen.

Or am I barking up totally the wrong tree with regards to multi touch?
Quote this message in a reply
Moderator
Posts: 133
Joined: 2008.05
Post: #5
By default, UIResponder subclasses (that is, anything that can respond to touchesBegan:withEvent: and company) have multi-touch disabled. You have to explicitly tell it that it can accept multitouch events. You can do this in a XIB file or in code.
Quote this message in a reply
Apprentice
Posts: 8
Joined: 2008.12
Post: #6
Cheers,

How?
Quote this message in a reply
Apprentice
Posts: 8
Joined: 2008.12
Post: #7
Found it. It's

[self setMultipleTouchEnabled:YES];

for anyone who finds this thread in the future...
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  pushing touch events to sdl michelleC 0 2,002 Mar 27, 2010 09:57 AM
Last Post: michelleC
  Model-View-Controller and touch events Vinnie 3 3,609 Jun 3, 2009 09:27 AM
Last Post: AnotherJake