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 7623301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:40:20+00:00 2026-05-31T04:40:20+00:00

How would you draw a line connector between two shapes, such that the line

  • 0

How would you draw a line connector between two shapes, such that the line draws with the proper angles and move along with any movement of the shapes?

Something like this:

enter image description here

I imagine a UIBezier Curve is what I need, but any tutorials or help in getting started would be appreciated.

  • 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-05-31T04:40:21+00:00Added an answer on May 31, 2026 at 4:40 am

    I think UIBezierPath is the right way to go, so you should definitely read up on it. I wrote a quick example for making a path there are many more options I’m not using.

    Drawing the paths is not the difficult part. You’ll have to track all the boxes you create and store the connections between them somehow, it depends greatly on how you store the boxes but a relational database feels like the right solution. Given these objects and connections, you’ll generate paths in drawrect for one of your views.

    - (void)drawRect:(CGRect)rect {
    
        // say we already created a "Make" box
        UIBoxThing *make = ...
        // and here we already created a "Diagrams" box
        UIBoxThing *diagrams = ...
    
        [[UIColor blackColor] setStroke];
    
        // since we know Diagrams and Make are connected (via some other data), we must draw an arrow between them
        UIBezierPath *path = [[UIBezierPath alloc] init];
        path.lineWidth = 2;
    
        // the midpoint of the right side of our first box
        CGPoint start = CGPointMake(make.frame.origin.x+make.frame.size.width, make.frame.origin.y+(make.frame.size.height/2));
    
        [path moveToPoint:start];
    
        // the midpoint of the left size of our second box
        CGPoint end = CGPointMake(diagram.frame.origin.x, diagram.frame.origin.y+(diagram.frame.size.height/2));
    
        [path addLineToPoint:end];
    
        [path stroke];
    }
    

    This would be complimented with code that can tell if boxes are to the right of one another or the left, and you can bend the line with addCurveToPoint: or a number of other methods on UIBezierPath. Most of the path stuff is depending on your style, there’s no one correct style to connect two points.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to draw a separator between two views. I am aware that
I have two points that draw a line when connected. The line can be
I'm trying to draw two circles at random positions and draw a line between
I have 2 CGPoints and a would like to draw straight line between them,
I would like to draw a straight line between where a user touches the
how to draw point and line between 2 points in opencv??? Would like by
I have two coordinates for which I would like to draw a perpendicular line
I'm trying to draw a line between two (2D) points when the user swipes
in vb.net i would like to draw a regular line on a form. is
I would like to draw some shapes on a JPanel by overriding paintComponent .

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.