Re: Cocoa: dragging files from Finder
Re: Cocoa: dragging files from Finder
- Subject: Re: Cocoa: dragging files from Finder
- From: Markus Spoettl <email@hidden>
- Date: Sat, 5 Jun 2010 21:57:29 -0400
On Jun 3, 2010, at 1:27 PM, Marcin Górski wrote:
> In my AppController class (main class in app) I create new myView object and in Interface Builder this object is connected with a Custom View layout. But when I run my app and try anything from Finder the console remains silent. Can anyone tell me what I'm missing?
If that is really the code you're using it could be your view is never actually dragging enabled, I believe your description points to that.
You can create a custom view in your nib by settings the class name in the "View Identity" tab to your class' name (in your case "myView"). Note however, that when a view is created in such a way, the designated initializer is not called because it's created in a different way.
Therefore the view that is created didn't call -registerForDraggedTypes:, so it never enabled dragging for files.
To fix the issue you can implement -awakeFromNib and call -registerForDraggedTypes: there.
Also note that the real designated initializer for NSViews is -initWithFrame:(NSRect)frameRect, not "init" as in your code (but that doesn't change the problem at hand).
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
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