Trouver le sens de défilement dans une UIScrollView?

J'ai un UIScrollView avec seulement le défilement horizontal permis, et je voudrais savoir quelle direction (gauche, droite) l'utilisateur fait défiler. Ce que j'ai fait était à la sous-classe le UIScrollView et remplacer le touchesMoved méthode:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesMoved:touches withEvent:event];

    UITouch *touch = [touches anyObject];
    float now = [touch locationInView:self].x;
    float before = [touch previousLocationInView:self].x;
    NSLog(@"%f %f", before, now);
    if (now > before){
        right = NO;
        NSLog(@"LEFT");
    }
    else{
        right = YES;
        NSLog(@"RIGHT");

    }

}

Mais cette méthode n'est pas appelée à tous quand je bouge. Qu'en pensez-vous?

InformationsquelleAutor Alex1987 | 2010-03-30