Questions tagged [uidragitem]

9 questions
8
votes
3 answers

Ability to shorten UIDragInteraction's long press timing

I am currently using UIDragInteraction and UIDropInteraction made available in iOS 11 to make a simple drag and drop feature, where user could drag an UIImageView onto a UIView. I realized that one unintuitive element to this is that the…
daspianist
  • 5,336
  • 8
  • 50
  • 94
7
votes
1 answer

UICollectionView reordering: interactive movement or drag and drop?

As of iOS 9, UICollectionView supports interactive movement via beginInteractiveMovement and its sibling methods. As of iOS 11, it also supports drag and drop, which seems to support movement as well. In iOS 13 beta 4, drag and drop gestures have…
Tom Hamming
  • 10,577
  • 11
  • 71
  • 145
6
votes
2 answers

Drag and Drop - create an NSItemProvider from my Model

Let's go by parts! I'm trying to implement Drag and Drop in my UICollectionViewController. The datasource for the UICollectionView is an array of a custom Model Struct I've created. As required I have set my collectionView.dragDelegate = self and by…
Ivan Cantarino
  • 3,058
  • 4
  • 34
  • 73
5
votes
0 answers

How to restrict a UIDragItem to an axis

I have a UIImageView which I have made it draggable by adding it an UIDragInteraction as shown in the code below. Now, I can drag it in any direction, however, I want the draggable item to be restricted to the y-axix(verticle). i.e. no motion along…
rahulg
  • 2,183
  • 3
  • 33
  • 47
5
votes
2 answers

Drag and Drop asynchronous data fetching

I am trying to implement Drag and Drop into my application which shares images. All my images are high performance thumbnails (i.e. small size) so I can't use them as my UIDragItem, at least not as the final image. What I am looking for is a way of…
Chris
  • 7,830
  • 6
  • 38
  • 72
3
votes
0 answers

How to prevent UIDragPreview snapshot resizing

I can make a custom drag view during drag-and-drop like so: let d = UIDragItem(itemProvider: itemProvider) d.previewProvider = { UIDragPreview(view: imageView) } But then if my imageView is 'too big', iOS will resize it down to something it thinks…
Colin
  • 3,670
  • 1
  • 25
  • 36
2
votes
1 answer

Why does empty UIDragItem array still allow row to be dragged?

Implementing iOS 11 Drag and Drop in a table view. If I don't want the first row to be dragged, I assume I return an empty array from tableView(:itemsForBeginning:) func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession,…
JKaz
  • 765
  • 6
  • 18
1
vote
0 answers

How to rotate the Drag&Drop preview in Swift

I have a problem rotating the preview when I drag a button. In this project I drag a button that represents a street that you can rotate, so when the user rotates the button I save the number of rotations in the button tag. I tried to use the…
0
votes
1 answer

update containment bounds while dragging a UI draggable element

I have a div where it can be resized and I'm not able to drag the draggable element it in the new bound. That is because the containment which is set at the time of adding the draggable element. Need to update the containment bound each time the…