코코아 가이드를 시작하셨습니까? Objective-C로 작성된 것은 쉽게 포팅 될 수 있습니다. 내가 여기에 시작할 것 : Drag and Drop Programming (developer.apple.com)
당신이, 당신이 프로젝트의 지원되는 문서 유형을 수정해야합니다 도크 아이콘에 드래그 지원하려면, 나는이 (rake config
을 확인을 할 방법을 잘 모르겠어요, 그것은 줄 수도 단서). 당신은 결국도이 방법을 구현해야합니다 다음 Rakefile
에 설치 블록에
app.info_plist['CFBundleDocumentTypes'] = [
{'CFBundleTypeRole': 'Viewer', 'CFBundleTypeExtensions': ['mp4','m4v','avi','*'] } ,
{'CFBundleTypeRole': 'Editor', 'CFBundleTypeExtensions': ['txt'] }
]
그리고 다음 메서드를 추가합니다
def application(sender, openFile: path)
# sender is an NSApplication, path is NSString
true # or false
end
OSX에서 직접 드래그 앤 드롭 한 적이 없지만 Apple 설명서를 참조하십시오. https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/DragandDrop/DragandDrop.html –