Drawing lines between windows just like in Interface Builder

Posted by Koning Baard on Stack Overflow See other posts from Stack Overflow or by Koning Baard
Published on 2010-06-13T10:57:15Z Indexed on 2010/06/13 11:02 UTC
Read the original article Hit count: 126

I have two windows, each with a round NSView:

------------------     ------------
|X-+ Oscillator  |     |X-+ Mixer |
|----------------|     |----------|
|                |     |          |
|        O       |     |     O    |
|                |     |          |
|                |     |          |
------------------     ------------

Both windows are in a seperate NIB. I want to be able to draw a line between the two round NSViews at runtime, using drag'n'drop, just like connecting IBOutlets in Interface Builder:

------------------     ------------
|X-+ Oscillator  |     |X-+ Mixer |
|----------------|     |----------|
|                |     |          |
|        O-------+-----+-----O    |
|                |     |          |
|                |     |          |
------------------     ------------

I also want to be able to determine to which NSViews the NSViews are connected using the drawn lines. I need this to connect Oscillators to Mixers. I also want to be able to remove the connections by dragging into empty space.

Can anyone explain me how to do this? Thanks.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa