touch events problem
<p>I found a very strange problem while handling touch events. The idea of an app is that i have an ImageView which contains a circle with text, that the user can rotate.
I've implemented a custom UIScrollView subclass to contain circle image. There i implemented methods touchesBegan, touchesMoved and touchesEnded in order to rotate my circle when user drags it left or right. Everything works fine, but when you try to drag it with one finger very fast from one side to another and in opposite direction, methods touchesBegan and touchesEnded are called different number of times. For example touchesBegan was called 1 time and touchesEnded 2 - 3 times. How can it be?</p>

<pre><code>   - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    if([[event touchesForView:self] count]==1){

            touchPoint = [[touches anyObject] locationInView:self];
            previousTouchPoint = touchPoint;
            angle = 0;
            if (((touchPoint.x &gt; 160)&amp;&amp;(touchPoint.y &lt; 210))||((touchPoint.x &lt; 160)&amp;&amp;(touchPoint.y &gt; 210))) {
                leftRotation = YES;
            }
            else {
                leftRotation = NO;
            }

            currentMoveAngle = 0;
        }
    }

    - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event{
        if([[event touchesForView:self] count] == 1){
                CGPoint newPoint = [[touches anyObject] locationInView:self];
                CGPoint origin;
                if (self.tag == 2) {
                    origin = CGPointMake(self.bounds.origin.x+self.bounds.size.width*0.5, 215);
                }
                else {
                    origin = CGPointMake(self.bounds.origin.x+self.bounds.size.width*0.5, 215);
                }
                previousTouchPoint.x -= origin.x;
                previousTouchPoint.y -= origin.y;
                CGPoint second = newPoint;
                second.x -= origin.x;
                second.y -= origin.y;
                CGFloat rotationAngle = [self rotationFromFirstPoint:previousTouchPoint toSecondPoint:second];

                previousTouchPoint = newPoint;
                [self rotateContentToAngle:rotationAngle animated:NO];
                currentMoveAngle += rotationAngle; 
            }

    }

- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event{
    if ([[event touchesForView:self] count] == 1){
        rotating = YES;
            CGFloat rotationAngle;
            CGPoint origin = CGPointMake(self.bounds.origin.x+self.bounds.size.width*0.5, 215);
            CGPoint lastPoint = [[touches anyObject] locationInView:self];
            CGPoint touchP = touchPoint;
            if ((touchP.x != lastPoint.x)||(touchP.y != lastPoint.y)) {
                touchP.x -= origin.x;
                touchP.y -= origin.y;
                lastPoint.x -= origin.x;
                lastPoint.y -= origin.y;

                if (fabs(currentMoveAngle)&gt;M_PI/6) {
                     NSInteger index = (int)trunc(currentMoveAngle/(M_PI/3));
                     currentMoveAngle-=(M_PI/3)*index;
                    NSLog(@"rotation index: %i",index);
                 }

                if (leftRotation) {
                    rotationAngle = M_PI/3;
                    rotationAngle-=currentMoveAngle;
                }
                else {
                    rotationAngle = (-1)*M_PI/3;
                    rotationAngle-=currentMoveAngle;
                }

                [self rotateContentToAngle:rotationAngle animated:YES];
            }   
        }
}
</code></pre>
