What the way create dragged image

Discussion in 'Mac Programming' started by roma86, Oct 29, 2012.

  1. roma86 macrumors newbie

    Oct 29, 2012
    Hi! I create any simple program and game for iPhone, but new on the mac os programming and cocoa.
    I want create editor map. It create plist file with image center coordinates and angles rotation added on the box area;
    Step 1. add background (it is not editable)
    Step 2. Images from table can be added to right area (click or drag). We can add more duplicate this object in the area.
    Added onto area objects can be moved within background image. We can get coordinates all images, can rotate it around center.
    Finally it's all will be exported into plist file as group image by name and items with coordinates.

    My question is: how to implement it. This is a joke. )
    My questions are:
    What the way create draggable object? Can i use image, or not?
    What i should use for area when object will be place? It's can be box view or other type view?
    What the way create plist file?

    I will be grateful for any tips and tutorials describing part of this task.
  2. misee macrumors member

    Jul 4, 2010
  3. roma86 thread starter macrumors newbie

    Oct 29, 2012
    Thanx. But this is not what I need. THis is drag-an-drop between application or within window. I want drag-and-drag-and-drag)) my object and get it coordinates.
    Thanx! this is what i need for creating plist files.
  4. misee macrumors member

    Jul 4, 2010
    So you want to drag an object inside an existing view? In that case, you could override NSViews mouseDragged: method. The event that is passed as argument will contain the position of the mouse in the window which you can then convert to your view like so:
    - (void)mouseDragged:(NSEvent *)theEvent {
        NSPoint pointInView = [self convertPoint:[theEvent locationInWindow] fromView:nil];
        // You can now use pointInView for setting a new location
    Check out the NSView documentation for more coordinate conversion methods or details about the one I used. Hope I understood what you want to do this time ;)

Share This Page