In an attempt to figure out how well gesture recognizers work, I've built a 
very simple app that uses a UIPanGestureRecognizer and using them to construct 
a UIBezierPath that I then stroke, but I am getting strange artifacts on the 
resulting drawing operation (see http://cl.ly/0N2R411O1t1x3w2N3Q3q for example).

The code I use is fairly simple; I start with a call to -moveToPoint:, followed 
by a bunch of -addLineToPoint: calls. Other than the fact that I am recording 
the points using touch, there is nothing unusual in the code (that I can see):

- (void) pannedRefineEdge:(UIPanGestureRecognizer *) recognizer {
    switch (recognizer.state) {
        case UIGestureRecognizerStateBegan:

            _path = [[UIBezierPath alloc] init];
            [_path moveToPoint:[recognizer locationInView:self.backgroundView]];
            
            break;
            
        case UIGestureRecognizerStateChanged:
            
            [_path addLineToPoint:[recognizer 
locationInView:self.backgroundView]];

            break;
            
        case UIGestureRecognizerStateEnded:

            // This calls a function that sets up an image drawing context and 
then:

            _path.lineCapStyle = kCGLineCapRound;
            _path.lineJoinStyle = kCGLineJoinRound;
            _path.lineWidth = 10.0;
        
            [[UIColor colorWithRed:1.0 green:0.6 blue:0.6 alpha:1.0] setStroke];

            [_path stroke];    
            
            break;
            
        default:
            break;
    }
}

Any ideas what could be causing the problem?

Thanks,


Marco
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to