how to drag and move child views in Grid to swap their positions

hs79hshs79hs AUMember ✭✭

I've searched some days but didn't get a good solution. I'm developing an Xamarin.iOS project, which uses Grid to arrange several views.

What I want is to drag and move one child view to another place to swap the positions of both views. For example, if I have 2 rows and 2 columns, let's call them view 0, 1, 2, 3. If I drag view 0 to view 2, then view 0 and 2 will swap their positions.

I first tried to use dragInteraction and dropInteraction, but by tests, it's not really moving the child view when dragging, just moving some provided data.

But search, I found some solutions for dragging and moving inside ListView. But seems ListView doesn't support multiple columns.

Could someone give me some clues to this? Very appreciate that. BTW, the child view I want to drag is an UIView playing video using AVPlayer.

Best Answer

  • hs79hshs79hs AU ✭✭
    Accepted Answer

    It seems I didn't search very hard:) Found answer soon after posted question. Used UIPanGestureRecognizer to drag and move.

Answers

  • hs79hshs79hs AUMember ✭✭
    Accepted Answer

    It seems I didn't search very hard:) Found answer soon after posted question. Used UIPanGestureRecognizer to drag and move.

Sign In or Register to comment.