• 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 From iTunes in NSView just like iWeb did
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Drag From iTunes in NSView just like iWeb did


  • Subject: Drag From iTunes in NSView just like iWeb did
  • From: "Nishant Yede" <email@hidden>
  • Date: Thu, 28 Sep 2006 12:50:17 +0530

Hi all of you,

 Does anyone know how to receive drags from iTunes in an NSView?  It must
be possible, because the same functinality is achived by iWeb. The problem
is, obviously, figuring out what drag types to register the NSView to
receive.
  My code is
  in init method i wrote
    [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];

- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
    NSPasteboard *paste = [sender draggingPasteboard];
    NSArray *types = [NSArray arrayWithObjects:NSFilenamesPboardType,nil];
    NSString *desiredType = [paste availableTypeFromArray:types];
    NSData *carriedData = [paste dataForType:desiredType];
    NSArray *urlArray = [paste propertyListForType:NSURLPboardType];
    NSString *data = [[NSString alloc] initWithString:[urlArray objectAtIndex:0]];

    if (nil == carriedData)
    {
        NSRunAlertPanel(@"Paste Error", @"Sorry, but the past operation failed", nil, nil, nil);
        return NO;
    }
    else
    {
		data = [data substringFromIndex:16];
		NSLog(data);
		if([musicFileType containsObject:[data pathExtension]])
		{
			[self createMusic:data];
		}
		else if([movieFileType containsObject:[data pathExtension]])
		{
			[self createMovie:data];
		}
		else if([imageFileType containsObject:[data pathExtension]])
		{
			[self createImage:data];
		}
		else if([docFileType containsObject:[data pathExtension]])
		{
			[self createDoc:data];
		}
		else
		{
			NSRunAlertPanel(@"UnSupported Files", @"Sorry, but the past operation failed due to unsupported files ", nil, nil, nil);
		}
	}

    return YES;
}
   Please check this code and reply what i did wrong in this.
   Thanks in advance.
By,
   Nishant

--
______________________________________________
IndiaInfo Mail - the free e-mail service with a difference! www.indiainfo.com
Check out our value-added Premium features, such as an extra 20MB for mail storage, POP3, e-mail forwarding, and ads-free mailboxes!
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Drag From iTunes in NSView just like iWeb did
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Re: detachDrawingThread:toTarget:withObject: vs detachNewThreadSelector:toTarget:withObject:
  • Next by Date: Re: detachDrawingThread:toTarget:withObject: vs detachNewThreadSelector:toTarget:withObject:
  • Previous by thread: Re: sluggish NSSlider with vsynced opengl
  • Next by thread: Re: Drag From iTunes in NSView just like iWeb did
  • Index(es):
    • Date
    • Thread