Hi everybody, I'm new here and I don't know if this is the right sub-forum.
I have some problems with the multi-touch for iOS. I thought "touchesBegan" from the UIView will always be called when a new finger touches the screen.
But it don't. It only occurs when the first finger touches the screen and "touchesEnded" occurs when the first finger releases the screen.
But I want to know when a new finger touches the screen. I don't know how to determine that in my program.
Another problem is that the "touchesMoved" only occurs when the first finger moves. The other fingers also get a movement information but this function will only be called when the first finger moves.
And the third problem I have is that the indices of the touches changes when new fingers touche the screen.
i.e. when I go-through the NSSet of all "[event allTouches]" the first touch can sometimes change to the second one when a new finger touches the screen.
This is my current code part:
Code:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
NSSet* touchSet = [event allTouches];
int i = 0;
for (id touch in touchSet)
{
CGPoint Point = [touch locationInView:self];
iOS_SetTouchBegin(i++, Point.x, Point.y);
}
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesMoved:touches withEvent:event];
NSSet* touchSet = [event allTouches];
int i = 0;
for (id touch in touchSet)
{
CGPoint Point = [touch locationInView:self];
iOS_SetTouchMove(i++, Point.x, Point.y);
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
NSSet* touchSet = [event allTouches];
int i = 0;
for (id touch in touchSet)
iOS_SetTouchEnd(i++);
}
My C functions "iOS_SetTouchBegin", "iOS_SetTouchEnd" and "iOS_SetTouchMove" always get the Index of the individual touch event.
But this is never guaranteed the correct Index.
I hope you understood my problem and anyone can help me.
Greetings,
Lukas