2

I have the following issue:

If i tap the touch screen with one finger (i.e. middle finger) and close to the moment that the finger is going up i tap with a second finger (i.e. index finger) close to the area where the other finger was, instead of getting a down event, i get a move of the first finger to the down position of the second finger. It is a little tricky to reproduce but it is reproducible.

I have a UIView and for the touches i have the following:

- (void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event
{
  for (UITouch *touch in touches) {
    int index = (int)touch;
    CGPoint position = [touch locationInView:self];
    NSLog(@"DOWN %d x:%f y:%f", index, position.x, position.y);
  }
}

- (void) touchesMoved: (NSSet *) touches withEvent: (UIEvent *) event
{
  for (UITouch *touch in touches) {
    int index = (int)touch;
    CGPoint position = [touch locationInView:self];
    NSLog(@"MOVE %d x:%f y:%f", index, position.x, position.y);
  }
}

- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
{
  for (UITouch *touch in touches) {
    int index = (int)touch;
    CGPoint position = [touch locationInView:self];
    NSLog(@"UP   %d %f %f", index, position.x, position.y);
  }
}

When i reproduce it i have the following output

DOWN 510365696 x:891.500000 y:197.000000
MOVE 510365696 x:774.000000 y:263.000000
MOVE 510365696 x:766.000000 y:268.500000
UP   510365696 764.500000 270.000000

where the above MOVE is the down position of the second finger. As you can also see the UP from the first finger which should be in pos (891,197) is totally lost...

I know that i could detect these "jumps" but there is no way to differentiate them from a fast moving finger.

I appreciate any help.

Tim Meyer
  • 12,210
  • 8
  • 64
  • 97
thodoris
  • 69
  • 8

1 Answers1

0

When I tried with your same code, what I observed is that, even the slightest movement in your finger is detected.

When you tap using your first finger and while holding it, if you tap using the second finger, the second finger position is not logged. Actually, what gets logged is the slight variation in point of your first finger which is observed as a move action.

The up position which gets logged is also somewhere near to the first finger touch point.

The down action of the second finger is never detected.

I think the problem is that Multiple Touch option is not enabled. With your view selected, in the Utilities pane, select Attributes Inspector and from there tick the Multiple Touch checkbox.

Here is a screen shot :

enter image description here

The actual Log when Multiple Touch is enabled will look like this:

DOWN 475396224 x:229.000000 y:6.500000
DOWN 475411840 x:102.000000 y:50.000000
MOVE 475396224 x:231.500000 y:8.000000
MOVE 475411840 x:104.500000 y:51.500000
UP   475396224 231.500000 8.000000
UP   475411840 104.500000 51.500000

Hope this helps !

GoGreen
  • 2,251
  • 1
  • 17
  • 29
  • The thing is that i need both the precision and the multitouch. The two fingers is an example that i gave to explain my problem. In my scenario i will have two touches in a fixed distance that might disappear/reappear, so the problems described above is unwanted behaviour or a hardware limitation. – thodoris Jan 29 '14 at 14:58
  • @thodoris I have edited my answer. Check if this works. – GoGreen Jan 30 '14 at 05:30
  • Thanks for the suggestion but I had this option already enabled. Multitouch in general works very well but this is an extreme case. What i think is happening is that this two finger gesture that i describe above, due to the fact that it is fast, is misunderstood for a fast finger move. In fast finger movements a finger is not following consecutive positions, just adjacent. By doing this fast with my fingers i can "trick" the hardware. I will have to find a workaround for it cause in the end this is the input i get and i have no control over it, only how to interpret it. – thodoris Jan 30 '14 at 16:30