Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

CollectionView : drag and drop

Hello,

I've 2 windows.

the first window : NSPanel with CollectionView

the second window : NSWindow + NSView

When i drag a NSImage from CollectionView (source) to NSView (destination), the drop doesn't work !

No drag methods in NSView are called.

*** In my NSCollectionView Delegate (NSImage with arrayController), i've been implemented these methods :


-(BOOL)collectionView:(NSCollectionView *)collectionView canDragItemsAtIndexes:(NSIndexSet *)indexes withEvent:(NSEvent*)event
- (BOOL)collectionView:(NSCollectionView *)cv writeItemsAtIndexes:(NSIndexSet *)indexes toPasteboard:(NSPasteboard *)pasteboard



*** In my NSView :


(id)initWithFrame:(NSRect)frame {
...
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSPasteboardTypePNG,
NSFilenamesPboardType, nil]];
-(BOOL)collectionView:(NSCollectionView *)collectionView acceptDrop:(id < NSDraggingInfo >)draggingInfo index:(NSInteger)index dropOperation:(NSCollectionViewDropOperation)dropOperation
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender {
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender {
- (void)drawRect:(NSRect)dirtyRect {



please, can you help me !

thanks you.

MacBook Pro, Mac OS X (10.6.8), XCode 4

Posted on Dec 26, 2011 10:58 PM

Reply

There are no replies.

CollectionView : drag and drop

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.