I have 4 UIView (each has a visible part on the screen) and I want them to be draggable.
I am adding them just like any other view on a controller with
addSubview:dragViewTop
addSubview:dragViewBottom
addSubview:dragViewRight
addSubview:dragViewLeft
My problem is that if I drag one view on top of another, even if I change it’s layer.zPosition, I am able to drag one that is supposed to be beneath.
That behavior is given (I think, not sure) by the order of the added views.
I want that the view I am dragging stays on top. Any ideas?
I hope I made myself clear.
You need to work with the superview of those views to deal with the order of the views, not their layers’ zPosition property.
Use the following methods of the superview to arrange the depth of the subviews. It seems you probably need only the first method, though.