• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Drag and drop display image and file path?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Drag and drop display image and file path?


  • Subject: Drag and drop display image and file path?
  • From: Henrietta Read <email@hidden>
  • Date: Tue, 21 Apr 2009 16:03:47 -0700

Hi, I have an Image Well (NSImageView) in a window. I would like to display
a drag and drop image in the view and pass the file path on to my controller
object. In my 'MyImageView' object I'm doing:


- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
    if((NSDragOperationGeneric &
        [sender draggingSourceOperationMask]) == NSDragOperationGeneric){
      return NSDragOperationGeneric;
    }
    else{
        return NSDragOperationNone;
    }
}


and:


- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{

    NSPasteboard *pboard = [sender draggingPasteboard];
    if([[pboard types] containsObject:NSFilenamesPboardType]){
        NSArray *files = [pboard propertyListForType:NSTIFFPboardType];
        [self setImage:[files objectAtIndex:0]];
        NSBeep();
    }
    return YES;
}


When I drag an image onto the view, I get the Beep but the image does not
display. Also how do I get the file path into my controller object? Is it
something to do with delegating performDragOperation into MyController?


Thank You.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Drag and drop display image and file path?
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: iphone SDK session duration
  • Next by Date: code behind NSRunAlertPanel
  • Previous by thread: Re: iphone SDK session duration
  • Next by thread: Re: Drag and drop display image and file path?
  • Index(es):
    • Date
    • Thread