NSView에서 testig 끌어다 놓을 수 있지만 draggingEntered:
은 호출되지 않습니다. 코드 :NSView에서 드래그 앤 드롭
#import <Cocoa/Cocoa.h>
@interface testViewDrag : NSView <NSDraggingDestination>
@end
@implementation testViewDrag
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[self registerForDraggedTypes:[NSImage imagePasteboardTypes]];
NSLog(@"initWithFrame");
}
return self;
}
-(NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender
{
NSLog(@"draggingEntered");
return NSDragOperationEvery;
}
-(NSDragOperation) draggingUpdated:(id<NSDraggingInfo>)sender
{
NSLog(@"draggingUpdated");
return NSDragOperationEvery;
}
@end
인터페이스 빌더에 기본 창에 subView (클래스가 testViewDrag로 설정 됨)를 추가합니다. 로그의 은 initWithFrame
로그를 볼 수 있지만 아무 것도 드래그하지 않으면 로그에 표시됩니다.
나는 무엇이 누락 되었습니까?
은 당신이 지금 어떻게 얻을 말해 줄 수 있다면 드래그 파일의 경로 : 예를 들어 –
, , 마법처럼 당신에게 그 일을 감사 [발신자 드래그 붙여 넣기] propertyListForType : NSFilenamesPboardType]; // 여기에서 원하는 내용을 처리하십시오. } –
정말 도움을 주시면 고맙겠습니다. 응용 프로그램의 las 지점이었습니다. 정말 고마워요. –