• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
UIBezierPath stroke oddity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UIBezierPath stroke oddity


  • Subject: UIBezierPath stroke oddity
  • From: Marco Tabini <email@hidden>
  • Date: Tue, 20 Mar 2012 22:09:25 -0400

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 (email@hidden)

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:

This email sent to email@hidden

  • Prev by Date: Re: NSFileOwnerAccountName will not assign to root
  • Next by Date: Re: Missing header files/folders?
  • Previous by thread: Re: NSFileOwnerAccountName will not assign to root
  • Next by thread: Re: Missing header files/folders?
  • Index(es):
    • Date
    • Thread