0

I'm struggling to create some view with sortable elements in it.

What I'm looking for is to have some elements, like 1-5 in one row, so that I can then drag them left and right and rearrange them, while also adding and deleting.

Like this, first row (1 2 3 4): jQuery sortable

Inside these elements I want to have a view, like some more controls, and changeable items. TableViews seem to only sort vertically, and the CollectionView doesn't really do that either, as far as I know.

Are there any implementations where I could have a look? What would be the approach here?

Thanks in advance! Chris

Chris Preston
  • 644
  • 8
  • 15
  • You should try collection view , I think it's properly for creating grid cells. – johnMa Mar 10 '14 at 09:44
  • I did, but it doesn't really support those dragging functionality. I also didn't find any tutorial or sample using CollectionView – Chris Preston Mar 10 '14 at 10:06
  • check out [this question](http://stackoverflow.com/questions/12713111/uicollectionview-effective-drag-and-drop). – johnMa Mar 10 '14 at 10:19

1 Answers1

0

I've had the same problem once and haven't found nothing Cocoa for that purpose. In principle thsi should help:

Use an NSMutableDictionary with Keys for each field, e.g. field_1 and a value, that contains the positionnr in the CollectionView. When reordering adjust the values to the change.

The data for the collectionView is an NSMutableArray, that is created/updated by using the number to display from the dictionary = value. An array can contain any data, also other array, and is used for the CollectionView.

macrene
  • 198
  • 1
  • 8