• 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
e: setAllowedFileTypes: (or similar) for NSPasteboard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

e: setAllowedFileTypes: (or similar) for NSPasteboard


  • Subject: e: setAllowedFileTypes: (or similar) for NSPasteboard
  • From: David Riggle <email@hidden>
  • Date: Sun, 04 Mar 2012 13:41:46 -0800

I think you also need to register for the drag types via -registerForDraggedTypes. I pass in a mix of UTIs and legacy pboard types and it seems to work. For example:

	[tableView registerForDraggedTypes:[NSArray arrayWithObjects:(NSString *)kUTTypeURL, NSPasteboardTypeString, @"ABPeopleUIDsPboardType", nil]];

In your -validateDrop method you can check the pasteboard for URLs that conform to local image files, for example.

The new NSPasteboard routines are poorly documented and badly represented in the sample code. Good luck figuring them out.

> Message: 5
> Date: Sun, 04 Mar 2012 07:01:30 -0800
> From: Jerry Krinock <email@hidden>
> To: Cocoa-Dev List <email@hidden>
> Subject: Re: setAllowedFileTypes: (or similar) for NSPasteboard
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=utf-8
>
>
> On 2012 Mar 04, at 01:28, Rick C. wrote:
>
>> I want to make a UTI array to limit what can be dragged onto my TableView.
>
> Implement -tableView:validateDrop:proposedRow:proposedDropOperation: and return NSDragOperationNone if the [info draggingPasteboard] contains stuff you don't want.
>
>> Sorry if I'm missing the obvious here
>
> Drag and drop is not obvious.  See: Table View Programming Guide ▸ Using Drag and Drop in Tables.
>

_______________________________________________

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: e: setAllowedFileTypes: (or similar) for NSPasteboard
      • From: "Rick C." <email@hidden>
  • Prev by Date: Re: NSURL and NSRegularExpression
  • Next by Date: Re: How are views supposed to reload after being nillified by memory warnings?
  • Previous by thread: Re: Weird DocSets URLs which NSURL can't handle
  • Next by thread: Re: e: setAllowedFileTypes: (or similar) for NSPasteboard
  • Index(es):
    • Date
    • Thread