Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8990639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:32:35+00:00 2026-06-15T22:32:35+00:00

I can draw a path and make the view drag-able via gesture recognizer. How

  • 0

I can draw a path and make the view drag-able via gesture recognizer. How would I make a point on the path drag-able. I suppose I would need to identify that point to check it’s location in the view and to reset it’s location to the point to which it is dragged, but that is what I am not sure how to do.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:32:36+00:00Added an answer on June 15, 2026 at 10:32 pm

    Bro there are function for detecting a hit on CGPath or UIBezierPath. ON touchesBegan: method you can use either one of following methods to detect if the hit point is on the path or not.

    For UIBezierPath: - (BOOL)containsPoint:(CGPoint)point

    For GGPath :

     bool CGContextPathContainsPoint (
       CGContextRef context,
       CGPoint point,
       CGPathDrawingMode mode
    );
    

    Then if this point is on your path then you can set a flag. and In touchesEnd method you can get the translated point. However need to redraw the path. Path will not be elastic.

    EDIT: One thing that my work for your case is CAShapeLayer. CAShapeLayer can draw a UIBazierPath or CGPathRef. And also its animatable via its properties of strokeend and strokestart. See following code to get the idea of drawing a path with CAShapeLayer

        UIBezierPath *path = [UIBezierPath bezierPath];
        // Draw your path acording to your requirements
        // Remember that you don't need to stroke path in this implementation
        CAShapeLayer *shapeLayer = [CAShapeLayer layer];
        shapeLayer.path = path.CGPath; // path is a UIBezierPath object
        shapeLayer.strokeColor = [UIColor redColor].CGColor;
        shapeLayer.fillColor = [UIColor clearColor].CGColor;
        shapeLayer.lineWidth = 1.5;
        shapeLayer.strokeStart = 0.0;
        shapeLayer.strokeEnd = 1.0;
        [shapeLayer renderInContext:ctx]; // you can also use addSubLayer: and drawInContext
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make an application in which I can draw a path on
I can draw a circle around a given point (x,y) with a command like
How I can draw bezier curve in canvas. I have only start point and
How can i draw a view on a canvas by giving the x,y position
In the game I'm developing I need this function: being able to draw on
I have a graph where user can draw the graph using touch gesture, i
I can draw many things using this : NSString *imagePath = [[NSBundle mainBundle] pathForResource:@dummy2.png
i can draw a string/image... with drawInRect/drawAtPoint. but how about if i want to
How i can draw hand free graphic objects in windows 8, like paint can.
In Visual studio I can draw 13 different application-icons in different resolutions and color

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.