How do I change the tintColor of UIDragPreviewParameters

63 views Asked by At

enter image description here

How do I change the number's background color to red?

UIDragPreviewParameters only provide a background color to modify the translucent cell.

I have a collection view and conform the dragDelegate and dropDelegate.

here is the method:

func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
    print("itemsForBeginning")
    return [UIDragItem(itemProvider: NSItemProvider())]
}

func collectionView(_ collectionView: UICollectionView, dragPreviewParametersForItemAt indexPath: IndexPath) -> UIDragPreviewParameters? {
    print("dragPreviewParametersForItemAt")
    let s = UIDragPreviewParameters()
    s.backgroundColor = .orange
    return s
}
0

There are 0 answers