hy,
sorry to bother you all again
I tried putting up events today. I managed to put up tap-events just fine, I can recognize taps, doubletaps, tripletaps, whatever.
I encountered problems when trying to respond to a swipe gestures though.
This is my code:
Code:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
if (touch.tapCount == 2 && touch.view == self) {
//Stuff that should be done on double-tap. this works fine.
}
if (touch.info == UITouchSwipedRight) {
//Everything in here is never executed
UILabel *test = [[UILabel alloc] initWithFrame:CGRectMake(100,100,100,100)];
test.text = @"Swiped to the right";
test.font = [UIFont systemFontOfSize:20];
[self addSubview:test];
}
}
the part that should be executed when a right-swipe is detected is never executed, no matter what I do. I also tried
if (touch.info & UITouchSwipedRight)
according to the iphone OS programming guide, though I don't really know if it does matter.
why does this not work? The code is exactly the same as in the example in the iphone OS guide (chapter event handling) but it does not work.
also: how would I detect flick gestures? because flicks are way easier to do by the user than swipes, so I would like to respond to flicks and swipes.
thanks