Created
December 26, 2014 18:44
-
-
Save jhoughjr/d68fe265c74706ecc01b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)mouseDown:(NSEvent *)theEvent | |
{ | |
DLog(@""); | |
// Write data to the pasteboard | |
NSArray *fileList = @[[NSString stringWithFormat:@"%@://%@", self.url.scheme, self.url.path]]; | |
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; | |
[pboard declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] | |
owner:nil]; | |
[pboard setPropertyList:fileList | |
forType:NSFilenamesPboardType]; | |
NSDraggingItem *item = [[NSDraggingItem alloc] initWithPasteboardWriter:self]; | |
[item setImageComponentsProvider:^NSArray *{ | |
NSDraggingImageComponent *imageComponent = [[NSDraggingImageComponent alloc] initWithKey:NSDraggingImageComponentIconKey]; | |
imageComponent.contents = self.memeImageView.image; | |
return @[imageComponent]; | |
}]; | |
[self beginDraggingSessionWithItems:@[item] | |
event:theEvent | |
source:self]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment