0

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
}
yxk
  • 11
  • 2
  • can you add code that used ?@yxk – iShox Apr 24 '23 at 09:57
  • It might not be possible. iOS itself creates the badge and updates its color depending on whether a drop is not possible (grey), possible (blue) or possible and will make a copy (green with a plus sign). – Geoff Hackworth Apr 24 '23 at 11:42

0 Answers0