Cocoa: Drag and Drop Images... how?

Discussion in 'Mac Programming' started by GavinT, Oct 10, 2007.

  1. GavinT macrumors member

    #1
    Hi.

    I don't want to know exactly how it's done... I'm just after a bit of guidance on which bit of material I should look at, or sample code to crib from.

    Anyway, the 'problem'.
    I've not written the application yet, and I'm just thinking up ways of using said up. This will be my first Cocoa app (I work in the software industry, Java mainly).

    Basically, I'll have a background image (a house plot, or a map), which will be user definable. This will be displayed in a view inside a window. The user will then be able to create a 'plot' which will have a number of attributes associated with it. Part of this will be it's geographical layout. So, what I intend to do is draw a semi-transparent rectangle (or 4 cornered polygon) on top of the image.
    In my model, I'd have an object storing the x-y coordinates of each vertex. I'd then draw (using NSPath I understand) the appropriate shape on top of the image. That I can pretty much work out how to do.

    What I'm stuck on find info about, is how to then allow the user to drag that shape around, and drag the vertices around to change the shape.
    The corresponding model object will then need to be updated (guess I can use Cocoa Bindings for that... in much the same way as you can with textboxes etc).

    Cheers,
    GT
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Read through Apple's documentation first. Then check out some other articles link, link - there's a lot of info out there. Your situation is more complex than normal, so start off understanding the simple concepts first and work your way up.
     
  3. GavinT thread starter macrumors member

    #3
    Thanks for those specific links. I forgot to look in the Cocoa Dev Central archive... was just looking at the current Tutorials. DOH!!! :eek:

    The other link looks good. That's been archived away.



    Anyway, as you say, first task is to get the main functionality of the program working. Get the Data Model sorted.
    The funky graphics and drag and drop comes in the second version... I was just thinking ahead as usual.
     

Share This Page