简体   繁体   中英

Strange NSCollectionView Drag and Drop problem

I'm creating an application that contains two NSCollectionView, one source, and one target, user drags the item from the source and drops to the target, the strange thing is that, if I run the App from Xcode, the drag & drop works perfectly(both validateDrop and acceptDrop were called), both Debug and Release. anyway, if I run the created application directly, the target collectionView won't show the line indicator and the dragging item always bounces back to the source collectionView, no validateDrop called.

 func collectionView(_ collectionView: NSCollectionView,
                        validateDrop draggingInfo: NSDraggingInfo,
                        proposedIndexPath proposedDropIndexPath: AutoreleasingUnsafeMutablePointer<NSIndexPath>,
                        dropOperation proposedDropOperation: UnsafeMutablePointer<NSCollectionView.DropOperation>) -> NSDragOperation {
        
        if collectionView == self.targetMovCollectionView
        {
            draggingInfo.animatesToDestination = true
            return .move
        }
        return [];
        
    }

 

What might be the issue?

Nothing technical, purchased one M1 Pro MacBook, installed Xcode 14, and use new Xcode 14 to build the project with Universal target, both running via binary and running from Xcode are working as expected, the problem just disappeared w/o any code updated. Dunno what was going on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM