You know that in a lot of Mac/iPhone applications (such as your Finder), when you are dragging a icon around, all other icons will be "repelled away" from your mouse and leave space for the icon you are dragging.
I am wondering if that's a built-in Cocoa function (in layout constraints etc?). If not, is there any library, or documents on how to implement it?
If you want to get it more-or-less for free, use an NSCollectionView.
If NSCollectionView doesn't fit your needs, it's fairly easy to implement it using NSAnimation. Basically, the way that NSToolbar or NSCollectionView does it (for example), is to figure out where the icon you're dragging would land if you let it go, and it sends the other icons to their new locations using Core Animation to move them smoothly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With