On Nov 27, 2012, at 20:11 , Graham Cox <[email protected]> wrote:

> Maintaining the selection is not really an issue, as I can easily restore it, 
> but I would like this to animate as intended. Any ideas?

I think you can do it like this:

A. Ensure that targetIndex isn't one of the selected row indexes. If it is, 
change it to the next available unselected row index.

B. Divide your selectedIndexes set into two sets, one containing the indexes 
less than targetIndex, the other containing indexes greater than targetIndex. 
Either part of the division could be empty.

C1. Loop over the "less than" set starting from its highest index and working 
down. At each iteration, move the row at the current index to the targetIndex 
row.

C2. Loop over the "greater than" set starting from its lowest index and working 
up. At each iteration, move the row at the current index to the targetIndex 
row, and increment targetIndex.

Am I crazy or isn't it just that easy? Note that there's no adjustment of 
indexes necessary, other than the increment of targetIndex in C2.


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to