Re: Dragging to Rearrange Outline View
Re: Dragging to Rearrange Outline View
- Subject: Re: Dragging to Rearrange Outline View
- From: Charles Jenkins <email@hidden>
- Date: Tue, 30 Sep 2014 08:31:38 -0400
Thank you, Kyle. :-) I’ll study the bit about using a custom pasteboard type.
On another strange note, I followed the quick start program in the Collection View Programming Guide last night, using Swift, and it up and worked! I really stressed over finding the syntax for the four KVO methods, but in the end I discarded the accessors (setPersonModelArray: and personModelArray:) because I figured the compiler would know to map them both to my var personModelArray, and just took my best shot at translating the other two method signatures. It’s not fully tested yet, but the window does populate with my sample data. I’m shocked that wasn’t more of a battle!
I did consult references to find that a property like personModelArray must be marked with the dynamic keyword for KVO to work.
--
Charles
On Saturday, September 27, 2014 at 11:14, Kyle Sluder wrote:
> On Sep 27, 2014, at 6:54 AM, Charles Jenkins <email@hidden (mailto:email@hidden)> wrote:
> >
> > I have a question that may be truly obvious and stupid, but here goes anyway.
> >
> > In my application, I’ll display an outline view, and I want the user to be able to drag nodes around to rearrange the tree however he likes.
> >
> > The table objects’ drag-related functions I’ve found seem to rely on the pasteboard, as if we were dragging information in from the Finder or another application.
> >
> > Are those the functions I should be looking at for rearranging the outline, or am I barking up the wrong tree?
>
> The pasteboard is indeed the way to go. After all, for any arbitrary outline view, the user could drag from your that outline view to another app.
>
> If in your case it only makes sense to drop within the outline view, you can use a custom pasteboard type that contains no data.
>
> (This is actually how Safari tabs work.)
>
> --Kyle Sluder
_______________________________________________
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