I’m sure there is a simple way to do this, but I just can’t find it. I have a content view with a certain number of custom subviews (DragView), which allow to be dragged.
When I click on a dragView, it shows the correct selection outline, then I can drag it around. The problem is, this dragView will pass “under” other dragViews. So the solution should be to move the selected dragView on top of the superview’s subviews. But how?
subviews are in a NSArray, so I can just remove the view and add it again (no possible index changes).
If it is so, that the index of your views are describing the front to back layering of your views, then you shouldn’t just exchange the position, but the former element at index 1, should become the element at index 2 and so on until you have replaced the current dragviews former position.
That is at least what I figure should be the natural way of reordering the dragviews.