I'm trying to get some advice on how to go about implementing the same sort of "drag to reorder" behavior found on a UITableView
but on a UIStackView
.
So far this is what I'm thinking:
arrangedSubview
sUIView
as a subview to the main view and that fills the entire main view. This overlay view will act as a "canvas" of sorts as I'm dragging the temporary "reorder" view—we'll call this the tempView
— around (more on that in 4)
alpha
of the arrangedSubview
to 0 (setting hidden = true
would result in the UIStackView
animating closing in as if it were removed.tempView
to the overlay view (see 3) with the same initial frame as the arrangedSubview
tempView
up or down and insert/remove the actual arrangedSubview
at a calculated index based on the position of the tempView
.state
is .Ended
and set the arrangedSubview.alpha = 1
and remove the overlay view from the main view.Any suggestions? Any glaring holes that anyone sees? What would you change? What direction would you go to accomplish this?
I've created a custom control to solve this problem that can be found here.
Please see my last comment on the question post regarding known issues and future updates.
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